Hello All
Could someone help on this please.
The code below is in the "Thisworkbook" module and when you click on save the code saves the sheet to the correct path and names the file with data from B13 and G13.
This code keeps bugging out on line "Me.SaveAs Filename:=Fname, FileFormat:=52", any idea's on how to fix this.
I am using excel 2007
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim Fname As String
Cancel = True
Application.EnableEvents = False
Fname = "S:\Branch Data\test office\testing\CAT no\" & Sheets("Sheet1").Range("B13").Value & " " & Format(Sheets("Sheet1").Range("G13").Value, "dd-mm-yyyy") & ".xlsm"
MsgBox Fname
Me.SaveAs Filename:=Fname, FileFormat:=52
Application.EnableEvents = True
End Sub
Could someone help on this please.
The code below is in the "Thisworkbook" module and when you click on save the code saves the sheet to the correct path and names the file with data from B13 and G13.
This code keeps bugging out on line "Me.SaveAs Filename:=Fname, FileFormat:=52", any idea's on how to fix this.
I am using excel 2007
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim Fname As String
Cancel = True
Application.EnableEvents = False
Fname = "S:\Branch Data\test office\testing\CAT no\" & Sheets("Sheet1").Range("B13").Value & " " & Format(Sheets("Sheet1").Range("G13").Value, "dd-mm-yyyy") & ".xlsm"
MsgBox Fname
Me.SaveAs Filename:=Fname, FileFormat:=52
Application.EnableEvents = True
End Sub