using macro to save a file produces runtime error 4198

K

Keith

I upgraded from Win-XP/Office 2003 to Win-7/Office 2007; the code below ran
fine in Word 2003 but in Word 2007 generates runtime error 4198.

The variables and directory location are valid. The parameters for FileName
are updated for Word 2007; the grammer for the FileName appears correct (no
grammer errors when macro runs as is, but grammer errors if I change the
string.)
When I substitute an actual file name in place of the variables, the code
runs w/o error, but the Debug.Print statements generate correct strings. I
feel kind of dumb- but what is different about use of variables in Office
2007?

Debug.Print myfile(0) & myfile(1) & myfile(2) & myfile(3) & myfile(4) &
myfile(5) & ".doc"
Debug.Print File_Loc & Application.Name

ChangeFileOpenDirectory File_Loc
ActiveDocument.SaveAs FileName:=(myfile(0) & myfile(1) & myfile(2) &
myfile(3) & myfile(4) & myfile(5) & """.doc"""), _
FileFormat:=wdFormatDocument, LockComments:=False, Password:="",
AddToRecentFiles:= _
True, WritePassword:="", ReadOnlyRecommended:=False,
EmbedTrueTypeFonts:= _
False, SaveNativePictureFormat:=False, SaveFormsData:=False,
SaveAsAOCELetter:=False
 

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