Hi all-
Having some trouble converting a word document into a PDF from my excel macro. This is the error message: invalid procedure call or argument.
Here is my code for saving the word document, then saving it as a PDF.
Set WrdApp = CreateObject("Word.Application")
WrdApp.Visible = True
Set WrdDoc = WrdApp.Documents.Open("C:\Users\" & UserID & "\Desktop\Quantien Evaluation Template 9.5.docx")
'SAVE THE WORD DOCUMENT AS A SEPARATE FILE
WrdDoc.SaveAs2 Filename:= _
"C:\Users\" & UserID & "\Desktop\ " & CustomerName & " " & City & " " & State & " " & CustomerNumber & " " & "Quantien Evaluation Agreement" & " " & Month(Now()) & "." & Day(Now()) & "." & Year(Now()) & ".doc" _
, FileFormat:=wdFormatXMLDocumentMacroEnabled, LockComments:=False, _
Password:="", AddToRecentFiles:=True, WritePassword:="", _
ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
False, CompatibilityMode:=14
'saving as a pdf....
WrdDoc.ExportAsFixedFormat OutputFileName:= _
"C:\Users\" & UserID & "\Desktop\ " & CustomerName & " " & City & " " & State & " " & CustomerNumber & " " & "Quantien Evaluation Agreement" & " " & Month(Now()) & "." & Day(Now()) & "." & Year(Now()) & ".pdf" _
, ExportFormat:=wdExportFormatPDF, OpenAfterExport:=True, OptimizeFor:= _
wdExportOptimizeForPrint, Range:=wdExportAllDocument, From:=1, To:=1, _
Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _
CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _
BitmapMissingFonts:=True, UseISO19005_1:=False
Having some trouble converting a word document into a PDF from my excel macro. This is the error message: invalid procedure call or argument.
Here is my code for saving the word document, then saving it as a PDF.
Set WrdApp = CreateObject("Word.Application")
WrdApp.Visible = True
Set WrdDoc = WrdApp.Documents.Open("C:\Users\" & UserID & "\Desktop\Quantien Evaluation Template 9.5.docx")
'SAVE THE WORD DOCUMENT AS A SEPARATE FILE
WrdDoc.SaveAs2 Filename:= _
"C:\Users\" & UserID & "\Desktop\ " & CustomerName & " " & City & " " & State & " " & CustomerNumber & " " & "Quantien Evaluation Agreement" & " " & Month(Now()) & "." & Day(Now()) & "." & Year(Now()) & ".doc" _
, FileFormat:=wdFormatXMLDocumentMacroEnabled, LockComments:=False, _
Password:="", AddToRecentFiles:=True, WritePassword:="", _
ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
False, CompatibilityMode:=14
'saving as a pdf....
WrdDoc.ExportAsFixedFormat OutputFileName:= _
"C:\Users\" & UserID & "\Desktop\ " & CustomerName & " " & City & " " & State & " " & CustomerNumber & " " & "Quantien Evaluation Agreement" & " " & Month(Now()) & "." & Day(Now()) & "." & Year(Now()) & ".pdf" _
, ExportFormat:=wdExportFormatPDF, OpenAfterExport:=True, OptimizeFor:= _
wdExportOptimizeForPrint, Range:=wdExportAllDocument, From:=1, To:=1, _
Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _
CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _
BitmapMissingFonts:=True, UseISO19005_1:=False