Word corrupts variables

  skeletal 21:35 25 Jul 2003

Hi people

I wonder if any of you have come across this problem? I have written some code in Word VBA and it works fine on two computers, has an odd fault on a third (won?t worry about that for now), and an odd but big fault on two others. I have tracked down the big fault to Word corrupting the values of 4 variables that I have embedded into the template. It deletes the value of one, replaces it with the value of the second, and shuffles them all up one.

All computers use Office 2000. It was written on XP pro, works on Me, and XP home; fails on XP pro and NT.

The way I add a variable is with the construction:

ActiveDocument.Variables.Add name:="name1", Value:="value1"

Throughout the code I have all sorts of checks to make sure I don?t add a new variable if one exists, do things if its empty/full etc. Remember this bit works fine on three computers.

There may be a variation in service packs between the machines (ie some are SP3, some maybe SP1). I don?t have ready access to the two non working ones so I?m just hoping someone will have come across this before and tell me its....!!

Thanks for any help you may have.


  skeletal 20:24 26 Jul 2003

Oh dear

I thought this may be hard! I'll try bumping it to tonight's pages!


PS I just noticed the apostrophes(in the original post) are question marks! Why are computers so hard?

  skeletal 16:24 10 Oct 2003

Just remembered to tick this one...just in case someone does a search on this problem...I have only just solved it...and I have been working on it all this time! A very, very brief explanation follows:

There is a bug in Office 2000 SR1 that looks like it is fixed by service pack 3 (fingers crossed) but in my case all the follwing has to be true for the fault to occur:

The use of document variables
Digitally signing my code (always do this)
Using a networked machine that does not have service pack 3

Also, on the many tries on various machines, I discovered that everyone leaves Word in various states e.g. one person was using "Markup edit mode". My software works differently if Word is in this state. I now have loads of extra routines that check what Word is doing, and to turn off all these states as necessary...I hope I have thought of them all!

You would not believe the hassle all this has been...it's a wonder anything works at all!!!!


This thread is now locked and can not be replied to.

Elsewhere on IDG sites

HP Envy x2 review: Hands-on

Iconic New York graphic designer Milton Glaser on his uplifting new subway posters

New iMac Pro release date, UK price & specs rumours

Comment suivre le parcours du père Noël ?