A family of Microsoft word processing software products for creating web, email, and print documents.
The active documents path can be stored with the following
StrFolder = activedocument.Path & application.PathSeparator
Hope this helps
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have the follow macro below which works great to pull info already in the document for the file name so it creates a standard filename format for each document without having to type the file name each time when saved.
Right now it defaults to save the PDF being created from the word .docx file to default file folder setup in word. I would like this to be the current folder that the .docx file is already saved to, not the main folder if that makes sense? Can anyone suggest how to modify the macro to achieve this? Not very good with code.
Thanks,
Sub savedefreport()
'
' savedefreport Macro
'
'
Dim strADDRESS As String, strDATE As String
Dim FD As FileDialog
Dim strFolder As String
Dim strFilename As String
strADDRESS = ActiveDocument.SelectContentControlsByTitle("ADDRESS")(1).Range.Text
strDATE = ActiveDocument.SelectContentControlsByTitle("DATE")(1).Range.Text
strFilename = "" & Deficiency & " " & Report & "" & strADDRESS & " " & Format(strDATE, "MMM d, yyyy") & ".pdf"
ActiveDocument.ExportAsFixedFormat OutputFileName:="Deficiency Report" & strFilename, _
ExportFormat:=wdExportFormatPDF, OpenAfterExport:=True, OptimizeFor:= _
wdExportOptimizeForPrint, Range:=wdExportFromTo, From:=2, To:=2, _
Item:=wdExportDocumentContent, IncludeDocProps:=True, KeepIRM:=True, _
CreateBookmarks:=wdExportCreateNoBookmarks, DocStructureTags:=True, _
BitmapMissingFonts:=True, UseISO19005_1:=False
End Sub
A family of Microsoft word processing software products for creating web, email, and print documents.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
Answer accepted by question author
The active documents path can be stored with the following
StrFolder = activedocument.Path & application.PathSeparator
Hope this helps