Not sure if this is the place to find the answer to my need, so hopefully someone can help. I have created a micro enabled Word template and my wish is to have a command button on the document perform a save as and to close the template without changing the original file. My issue is that I want the button to save the document as the current date, but have not figured out how to string it. I am working in the VBA format of Microsoft 2007. Here is what I have so far, with {{{Current Date}}} being the current date when saved
Thanks
.
Private Sub CommandButton1_ Click()
'
' Saveandexit Macro
'
'
ChangeFileOpenD irectory " Y:\Truck Check\Engine 1\"
ActiveDocument. ExportAsFixedFo rmat OutputFileName: = _
"K:\Truck Check\Engine 1\{{{Current Date}}}.pdf", ExportFormat:= _
wdExportFormatP DF, OpenAfterExport :=false, OptimizeFor:= _
wdExportOptimiz eForPrint, Range:=wdExport AllDocument, From:=1, To:=1, _
Item:=wdExportD ocumentContent, IncludeDocProps :=False, KeepIRM:=True, _
CreateBookmarks :=wdExportCreat eNoBookmarks, DocStructureTag s:=True, _
BitmapMissingFo nts:=True, UseISO19005_1:= False
'
' stopexit Macro
'
'
ActiveDocument. Close
End Sub
Thanks
.
Private Sub CommandButton1_ Click()
'
' Saveandexit Macro
'
'
ChangeFileOpenD irectory " Y:\Truck Check\Engine 1\"
ActiveDocument. ExportAsFixedFo rmat OutputFileName: = _
"K:\Truck Check\Engine 1\{{{Current Date}}}.pdf", ExportFormat:= _
wdExportFormatP DF, OpenAfterExport :=false, OptimizeFor:= _
wdExportOptimiz eForPrint, Range:=wdExport AllDocument, From:=1, To:=1, _
Item:=wdExportD ocumentContent, IncludeDocProps :=False, KeepIRM:=True, _
CreateBookmarks :=wdExportCreat eNoBookmarks, DocStructureTag s:=True, _
BitmapMissingFo nts:=True, UseISO19005_1:= False
'
' stopexit Macro
'
'
ActiveDocument. Close
End Sub
Comment