C
Charles
I have a vbscript program which creates and saves a word document using the
automation interface. This was working with Word 2003, but since the upgrade
to Word 2007 it is consistently failing on the call to the SaveAs method. The
error is "The server threw and exception" with code 80010105, and source:
(null). I'm using XP SP 3. This is a simplified code example which is failing
in this way.
set word = createObject("word.application")
word.visible = true
word.documents.add
word.activeDocument.saveAs "Test.docx"
I've tried using the document format parameter to force it to be the XML
document format, or forcing the format as Word 97 (and using a ".doc" name),
also setting all of the option parameters for the SaveAs method. I've tried
having the script sleep before calling SaveAs to see if a timing issue
existed. Specified the full path. Nothing seems to make any difference. Calls
to saveAs will work if I write them in VBA inside the word VBA editor, but
not from VBScript running either as cscript.exe or wscript.exe. The document
it's trying to create (current directory for the WINWORD.EXE process is My
Documents folder) does not exist.
Anyone have any ideas?
automation interface. This was working with Word 2003, but since the upgrade
to Word 2007 it is consistently failing on the call to the SaveAs method. The
error is "The server threw and exception" with code 80010105, and source:
(null). I'm using XP SP 3. This is a simplified code example which is failing
in this way.
set word = createObject("word.application")
word.visible = true
word.documents.add
word.activeDocument.saveAs "Test.docx"
I've tried using the document format parameter to force it to be the XML
document format, or forcing the format as Word 97 (and using a ".doc" name),
also setting all of the option parameters for the SaveAs method. I've tried
having the script sleep before calling SaveAs to see if a timing issue
existed. Specified the full path. Nothing seems to make any difference. Calls
to saveAs will work if I write them in VBA inside the word VBA editor, but
not from VBScript running either as cscript.exe or wscript.exe. The document
it's trying to create (current directory for the WINWORD.EXE process is My
Documents folder) does not exist.
Anyone have any ideas?