Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / August 2005

Tip: Looking for answers? Try searching our database.

Macros run in Word 2002 but not 2003

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Robert F. Jones - 01 Aug 2005 20:16 GMT
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
Ed - 01 Aug 2005 22:18 GMT
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

> I have a pretty extensive collection of macros that create, modify and store
> word documents. These include macros imbedded in templates.
[quoted text clipped - 4 lines]
> Thanks
> Robert
Robert F. Jones - 02 Aug 2005 12:56 GMT
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

> 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.
[quoted text clipped - 11 lines]
> > Thanks
> > Robert
Ed - 02 Aug 2005 16:39 GMT
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

> Thanks Ed.  I checked References, and they were identical with the exception
> that Word 2003 was running Microsoft Word and Office 11 Object Librafy
[quoted text clipped - 34 lines]
> Thanks
> Robert
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.