thanks for your help in the past and future.
anytime the the file opens I want cell G5 to increase by 1 each time.
then I want the file to save.
anytime someone clicks save I want the filename to be a collection of strings.
my code for item 1 works and my code for item 2 works, but when I try to use both it’s not saving after opening so my count is not progressing.
Private Sub Workbook_Open() Range("G5") = Range("G5") 1 ActiveWorkbook.Save End Sub Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) Dim Path As String Application.EnableEvents = False Cancel = True Dim FileName1 As String Dim Filename2 As String Dim Filename3 As String Dim Filename4 As String FileName1 = Range("C3").Text Filename2 = Range("C4").Text Filename3 = Range("G4").Text Filename4 = Range("G5").Text Application.DisplayAlerts = False ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path & "" & FileName1 & "." & Filename2 & "." & Filename3 & "." & Filename4 & ".xlsx", FileFormat:=xlOpenXMLWorkbook Application.DisplayAlerts = True End Sub
My big picture goal is to have a TEMPLATE file that can be opened to create a new order with a unique order number. I also want to ensure that if someones opens it and just clicks save that proper naming procedures are followed and the original TEMPLATE is preserved.
I could make the save as code be a workbook close event, but I want to make sure that the template isn’t saved over accidentally.