L
Larry Wallis
Hi All
This was to be an email to Microsoft, but as I have a
corporate license version of Office, I apparently can't
ask them! So here goes...
I have a really odd problem with Word 2000 VBA that I have
posted to various other expert forums for a solution with,
so far, no success.
I have written some code in Word VBA and it works fine on
4 computers, but fails on 5. I have run the code dozens of
times in many variations and it never fails on the 4
working ones, but fails in different ways on the "fails".
All faults appear to be related to the way Word stores
variables using the construction:
ActiveDocument.Variables.Add name:="xxx", Value:=yyy
I have four such variables.
I have embedded the code in a template. One method of
installing my code on a machine is to put the template in
the Templates folder. In Word I click on the template to
open it. If I now close Word it crashes and I get the
error message:
Winword.EXE Application Error
The instruction at "0x308e05a0" referenced memory
at "0x0182a27a". The memory could not be "written". Click
OK to terminate etc.
The only way to install my software is to (in VBA editor
on a working machine) REMark out all four instances
of "Variables.Add."
Export code to a floppy.
Go to "fail" machine.
In VBA editor Import code.
Compile code.
Save.
Exit Word.
Restart Word.
In VBA editor UN-REM the four commands.
Compile.
Exit Word.
Restart Word.
Code works (mostly, but one machine has a new fault, but
one thing at a time!).
Incredibly, just importing the file without REMing out the
four commands will crash Word. This happens even if I
DON'T COMPILE OR RUN THE CODE!! It is the mere presence of
the "add variable lines" as imported from a working
machine.
Another failure mode is that provided I don't get
the "referenced memory error" (very rare) Word will delete
the value of one variable, replace it with the value of
the second, and shuffles them all up one!
When it crashes, it is so bad the machines have to be
restarted; closing Word is insufficient.
The 9 computers have a variety of operating systems:
Working: XP, ME, 2000. Non-working: XP, NT4, 2000.
All non-working are networked (different networks for
different parts of the company for which I work). All
working are not networked.
My guess is that something to do with a network is
allocating a memory area that Word VBA also wants to use
to store data about the "Variables.Add".
The question is, how can I make my code work reliably on
the various networked computers we use??
I cannot find any info about this, but surely I am not the
only person to store data in Word variables and use a
network!!
PLEASE help!!!
Thank you
Larry Wallis
This was to be an email to Microsoft, but as I have a
corporate license version of Office, I apparently can't
ask them! So here goes...
I have a really odd problem with Word 2000 VBA that I have
posted to various other expert forums for a solution with,
so far, no success.
I have written some code in Word VBA and it works fine on
4 computers, but fails on 5. I have run the code dozens of
times in many variations and it never fails on the 4
working ones, but fails in different ways on the "fails".
All faults appear to be related to the way Word stores
variables using the construction:
ActiveDocument.Variables.Add name:="xxx", Value:=yyy
I have four such variables.
I have embedded the code in a template. One method of
installing my code on a machine is to put the template in
the Templates folder. In Word I click on the template to
open it. If I now close Word it crashes and I get the
error message:
Winword.EXE Application Error
The instruction at "0x308e05a0" referenced memory
at "0x0182a27a". The memory could not be "written". Click
OK to terminate etc.
The only way to install my software is to (in VBA editor
on a working machine) REMark out all four instances
of "Variables.Add."
Export code to a floppy.
Go to "fail" machine.
In VBA editor Import code.
Compile code.
Save.
Exit Word.
Restart Word.
In VBA editor UN-REM the four commands.
Compile.
Exit Word.
Restart Word.
Code works (mostly, but one machine has a new fault, but
one thing at a time!).
Incredibly, just importing the file without REMing out the
four commands will crash Word. This happens even if I
DON'T COMPILE OR RUN THE CODE!! It is the mere presence of
the "add variable lines" as imported from a working
machine.
Another failure mode is that provided I don't get
the "referenced memory error" (very rare) Word will delete
the value of one variable, replace it with the value of
the second, and shuffles them all up one!
When it crashes, it is so bad the machines have to be
restarted; closing Word is insufficient.
The 9 computers have a variety of operating systems:
Working: XP, ME, 2000. Non-working: XP, NT4, 2000.
All non-working are networked (different networks for
different parts of the company for which I work). All
working are not networked.
My guess is that something to do with a network is
allocating a memory area that Word VBA also wants to use
to store data about the "Variables.Add".
The question is, how can I make my code work reliably on
the various networked computers we use??
I cannot find any info about this, but surely I am not the
only person to store data in Word variables and use a
network!!
PLEASE help!!!
Thank you
Larry Wallis