Excel 스크립트에서 문서 파일을 만들어 pdf 파일로 저장하려고합니다. 문서를 만드는 것은 문제없이 진행되지만 pdf 파일로 저장하는 데 적합한 코드를 찾는 것이 문제인 것 같습니다. 나는 인터넷을 검색 한 모두가 동일한 코드에 와서 같은 질문에 많은 매뉴얼과 답변이 있습니다 : 어떻게 든VBA - Excel에서 pdf로 Word doc 저장 - 명명 된 인수가 없습니다.
ActiveDocument.ExportAsFixedFormat OutputFileName:= _
ActiveDocument.Path & "\" & ActiveDocument.Name & ".pdf", ExportFormat:= _
wdExportFormatPDF, OpenAfterExport:=False, OptimizeFor:= _
wdExportOptimizeForPrint, Range:=wdExportAllDocument, _
Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _
CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _
BitmapMissingFonts:=True, UseISO19005_1:=False
그것은 나를주기 때문에 즉, 나를 위해 트릭을하지 않는 것은 오류 "명명 된 인수를 찾을 수 없습니다". 여기에 내 스크립트가있다. (나는 관련없는 라인을 빠뜨 렸고 경로와 파일 이름이 올바르게 저장되었다고 확신한다.)
'Dim Word formfield values
Dim objWord As Object
Dim strDocName As String, strDocName1 As String, strDocName2 As String
Dim strMyPath As String
'Declare Word variables
Set objWord = CreateObject("word.application")
objWord.Visible = True
With objWord.activedocument
'fill in a bunch of formfields
.ExportAsFixedFormat Type:=xlTypePDF, Filename:=strMyPath & "\" & strDocName2, _
OpenAfterExport:=False
.Close
End With
내가 뭘 잘못하고 있니?