Re: Macros run in Word 2002 but not 2003 by Ed
Ed
Tue Aug 02 10:39:53 CDT 2005
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
"Robert F. Jones" <RobertFJones@discussions.microsoft.com> wrote in message
news:51893E2C-B898-4348-89DB-AC1A6C5FC539@microsoft.com...
> 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
>