Hello everyone,
I hope that everything is going well with you!
I have a Word userform and it works clearly. After the work is finished, It can automatically save the pdf version in the same location with the word file.
After pressing the save button, I want it to save as word at the same time and I want it to close the current word document I am working with and open the new saved word file automatically. If you can help me, it will make my day.
Here is my pdf save codes. I couldn't edit this for word save.
I hope that everything is going well with you!
I have a Word userform and it works clearly. After the work is finished, It can automatically save the pdf version in the same location with the word file.
After pressing the save button, I want it to save as word at the same time and I want it to close the current word document I am working with and open the new saved word file automatically. If you can help me, it will make my day.
Here is my pdf save codes. I couldn't edit this for word save.
VBA Code:
Dim strPath As String
Dim strPDFname As String
strPDFname = "Commercial Form " & Me.TextBox3.Value
strPath = ActiveDocument.Path
If strPath = "" Then 'doc is not saved yet
strPath = Options.DefaultFilePath(wdDocumentsPath) & Application.PathSeparator
Else
'just add \ at the end
strPath = strPath & Application.PathSeparator
End If
ActiveDocument.ExportAsFixedFormat OutputFileName:= _
strPath & strPDFname & ".pdf", _
ExportFormat:=wdExportFormatPDF, _
OpenAfterExport:=False, _
OptimizeFor:=wdExportOptimizeForPrint, _
Range:=wdExportAllDocument, _
IncludeDocProps:=True, _
CreateBookmarks:=wdExportCreateWordBookmarks, _
BitmapMissingFonts:=True
UserForm1.Hide