M
Michael A
I've got a vbs script that opens a word doc and saves it as a pdf in
word 2007. I'm encountering a problem if I open a word doc that has a
fill-in field. When I do a save as it pops up a dialog box asking for
input for the field. I want to ignore this and just do the save as to
pdf with whatever is already there.
Two things: Can I detect that this has happened? How do I do this?
If I can detect it I can determine how to proceed (I will probably
just toss an error back and move on, but if I can ignore and do the
save as without tossing an error that would be preferable).
Part of the code that is important:
' Open the Word document
on error resume next
Set wdoc = wdocs.Open(sDocFile, False,nil,nil,"?#nonsense@$")
Select Case Err.Number
Case 0
' Let Word document save as PDF
' - for documentation of SaveAs() method,
' see http://msdn2.microsoft.com/en-us/library/bb221597.aspx
wdoc.SaveAs sPDFFile, wdFormatPDF
Select Case Err.Number
Case 0
wdoc.Close WdDoNotSaveChanges
Case Else
WScript.Echo "save_problem"
End Select
Case 5408
WScript.Echo "password"
Case 4198
WScript.Echo "popup"
Case Else
Wscript.Echo "problem"
End Select
wdo.Quit WdDoNotSaveChanges
The SaveAs is not throwing an error or else the Select Case Err.Number
would have detected that and kicked out correctly. So there must be
another way to detect something like this.
Thanks in advance.
word 2007. I'm encountering a problem if I open a word doc that has a
fill-in field. When I do a save as it pops up a dialog box asking for
input for the field. I want to ignore this and just do the save as to
pdf with whatever is already there.
Two things: Can I detect that this has happened? How do I do this?
If I can detect it I can determine how to proceed (I will probably
just toss an error back and move on, but if I can ignore and do the
save as without tossing an error that would be preferable).
Part of the code that is important:
' Open the Word document
on error resume next
Set wdoc = wdocs.Open(sDocFile, False,nil,nil,"?#nonsense@$")
Select Case Err.Number
Case 0
' Let Word document save as PDF
' - for documentation of SaveAs() method,
' see http://msdn2.microsoft.com/en-us/library/bb221597.aspx
wdoc.SaveAs sPDFFile, wdFormatPDF
Select Case Err.Number
Case 0
wdoc.Close WdDoNotSaveChanges
Case Else
WScript.Echo "save_problem"
End Select
Case 5408
WScript.Echo "password"
Case 4198
WScript.Echo "popup"
Case Else
Wscript.Echo "problem"
End Select
wdo.Quit WdDoNotSaveChanges
The SaveAs is not throwing an error or else the Select Case Err.Number
would have detected that and kicked out correctly. So there must be
another way to detect something like this.
Thanks in advance.