Macros run in Word 2002 but not 2003

  • Thread starter Robert F. Jones
  • Start date
R

Robert F. Jones

I have a pretty extensive collection of macros that create, modify and store
word documents. These include macros imbedded in templates.
This collection of macros runs fine on all my machines that run Word 2002,
but I recently purchased a machine with Word 2003. Macro security settings
are on low, and my virus scanning software is off. Does Word 2003 have some
inherent security that 2002 didn't, and can I disable it?
Thanks
Robert
 
E

Ed

You might check your References and make sure you have the correct library
for your version of Word. I ran into this when moving from 2000 to XP.
Ed
 
R

Robert F. Jones

Thanks Ed. I checked References, and they were identical with the exception
that Word 2003 was running Microsoft Word and Office 11 Object Librafy
instead of 10.

Here is an example of a bit of the code that runs in Word 2002 but not 2003:

Sub CopyPtInfo()
'
' CopyPtInfo Macro
' Macro recorded 01/23/00 by H I S CLIENT
'

'Save the PtInfo to generate a new document in case it is a new one.
'If a saved PtInfo file, just copy.
If ActiveDocument.Bookmarks.Exists("bmktxtFullName") Then
If Not ActiveDocument.txtFullName.Locked Then
'Concatenate the parts of the document path
ToFilePath = "R:\to file\"
PtInfoPath = ToFilePath & LastNameFirstName & ".rtf"
ActiveDocument.txtFullName.Locked = True
ActiveDocument.txtFullName.SpecialEffect = fmSpecialEffectFlat
ActiveDocument.txtDOB.Locked = True
ActiveDocument.txtDOB.SpecialEffect = fmSpecialEffectFlat
ActiveDocument.txtReference.Locked = True
ActiveDocument.txtReference.SpecialEffect = fmSpecialEffectFlat
ActiveDocument.SaveAs FileName:=PtInfoPath,
FileFormat:=wdFormatRTF
End If
End If
Selection.WholeStory
Selection.Copy
ActiveWindow.Close False
End Sub

This seems to hang right at the very beginning...

Thanks
Robert
 
E

Ed

Robert: I'm *not* a "power expert" by any means, so hopefully someone else
with major experience will chime in here, but here's my thoughts.
-- When you moved your macros to your new machine, did you move
*everything*?? There's not a function or add-in left behind that this
procedure might call to?
-- Step though the macro using F8. Give us the exact line where it hangs
and what the error is.
-- Mouse over or Debug.Print every variable to make sure it's what you
expect.
-- I don't see any variable declarations? I assume you have everything
declared somewhere?
-- I would avoid using "ActiveDocument" and "Selection", if possible. Set
an object to the document. One thing this allows is to type the object
reference "doc.", and get a list of available properties and methods. You
might try this and see if the property or method you're trying to call is
still available in Word 11.
-- What I had to do in a similar situation (changed 2000 to XP) was
reinstall the lower version back on the machine in a different folder to
have access to the lower version library. This may not be what you need,
but it was what solved that problem for me.

Good luck!
Ed
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top