bepedicino
Board Regular
- Joined
- Sep 29, 2014
- Messages
- 73
I have a Excel Template which contains the below macro. How can I run the macro automatically when I open the template file?
----------------------------
Sub PrepSpreadsheet()
Const Ffold As String = "D\Documents\file" 'change as required
Dim Fname As String
Fname = "Product Classification"
Fname = Fname & " - " & Format(Date, "yyyymmdd") & ".xlsm"
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs _
Filename:=Ffold & Application.PathSeparator & Fname, _
FileFormat:=xlOpenXMLWorkbookMacroEnabled
Application.DisplayAlerts = True
End Sub
----------------------------
Sub PrepSpreadsheet()
Const Ffold As String = "D\Documents\file" 'change as required
Dim Fname As String
Fname = "Product Classification"
Fname = Fname & " - " & Format(Date, "yyyymmdd") & ".xlsm"
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs _
Filename:=Ffold & Application.PathSeparator & Fname, _
FileFormat:=xlOpenXMLWorkbookMacroEnabled
Application.DisplayAlerts = True
End Sub