Thread: [Solved] Insert variable in path name
View Single Post
 
Old 01-03-2019, 05:20 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,383
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Is there a reason for not using SaveAs, or the FileSave dialogue? That said, you could use:
Code:
Dim StrNm As String
StrNm = InputBox("PDF File Name")
StrNm = "P:\My Documents\Excel\Stock Information\Good Files\PDF\" & StrNm & ".pdf"
ActiveDocument.ExportAsFixedFormat OutputFileName:=StrNm, _
  ExportFormat:=wdExportFormatPDF, OpenAfterExport:=True, _
  OptimizeFor:=wdExportOptimizeForPrint, Range:=wdExportAllDocument, _
  Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _
  CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _
  BitmapMissingFonts:=True, UseISO19005_1:=False
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote