You really should look up Word's ExportAsFixedFormat and Open methods for this. You should also declare all variables and, presumably, close the document and quit Word when you're done.
Try:
Sub Create_PDF_File_of_Word_Document()
Dim wdApp As Object, wdDoc As Object, StrPath As String, StrFlNm As String
StrPath = "C:\Data\"
StrFlNm = "Jul-15 Variance Analysis.docx"
Set wdApp = CreateObject("Word.Application")
With wdApp
'.Open FileName:=StrPath & StrFlNm , ReadOnly:=True, AddToRecentFiles:=False
Set wdDoc = .Documents.Open(StrPath & StrFlNm, True, False)
With wdDoc
'ExportAsFixedFormat Outputfilename:=.FullName, Exportformat:=wdExportFormatPDF, _
'OpenAfterExport:=False, OptimizeFor:=wdExportOptimizeForPrint, Range:=wdExportFromTo, From:=1, To:=1
.ExportAsFixedFormat Split(.FullName, ".doc")(0) & "A.pdf", 17, 0, False, 3, 1, 1
.ExportAsFixedFormat Split(.FullName, ".doc")(0) & "B.pdf", 17, 0, False, 3, 2, 3
.Close
End With
.Quit
End With
Set wdDoc = Nothing: Set wdApp = Nothing
End Sub
Bookmarks