J
Johnnyboy5
Hi
I am nearly there - for what I need anyway.
The macro below doesn't allow me to edit the sheet (template sheet)
and re-save it as a "template" it will only save as a file.
How to I stop the macro from running the save function in order that I
can save it as a template - but at the same time know that when the
template is used it will run the macro.
Johnnny
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
mydrive = "H:"
mydir = "Temp"
myname = Sheets("sheet1").Range("a1")
ms = mydrive & "\" & mydir & "\" & myname & ".xls"
ActiveWorkbook.SaveCopyAs Filename:=ms
' Place the current files path and filename in the titlebar:
Windows(1).Caption = ActiveWorkbook.FullName
' Place your own application name in the titlebar:
Application.Caption = "SPICE SHEET FOLDER"
Cancel = True
ActiveWorkbook.Saved = True
msg = MsgBox("The workbook has been saved as " & ms, vbInformation +
vbOKOnly, "Save As")
Application.DisplayFullScreen = False
End Sub
I am nearly there - for what I need anyway.
The macro below doesn't allow me to edit the sheet (template sheet)
and re-save it as a "template" it will only save as a file.
How to I stop the macro from running the save function in order that I
can save it as a template - but at the same time know that when the
template is used it will run the macro.
Johnnny
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
mydrive = "H:"
mydir = "Temp"
myname = Sheets("sheet1").Range("a1")
ms = mydrive & "\" & mydir & "\" & myname & ".xls"
ActiveWorkbook.SaveCopyAs Filename:=ms
' Place the current files path and filename in the titlebar:
Windows(1).Caption = ActiveWorkbook.FullName
' Place your own application name in the titlebar:
Application.Caption = "SPICE SHEET FOLDER"
Cancel = True
ActiveWorkbook.Saved = True
msg = MsgBox("The workbook has been saved as " & ms, vbInformation +
vbOKOnly, "Save As")
Application.DisplayFullScreen = False
End Sub