Hi,
I'm new to VBA, but I'm trying to create a macro that will save an excel file as a cell name. The code that I have written so far is:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
ThisFile = Range("V4").Value
ActiveWorkbook.SaveAs Filename:=ThisFile
ActiveWorkbook.SaveAs Filename:="W:SharedDummyMTC Tracking SheetMTC" & ThisFile
End Sub
The problem is when I place this code in 'ThisWorkbook' under BeforeSave I get the following error msg:
'Excel.exe has generated errors and will be closed by Windows. You will need to restart the program, an error log has been created'
does anyone know what I might be doing wrong?
Thanks
I'm new to VBA, but I'm trying to create a macro that will save an excel file as a cell name. The code that I have written so far is:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
ThisFile = Range("V4").Value
ActiveWorkbook.SaveAs Filename:=ThisFile
ActiveWorkbook.SaveAs Filename:="W:SharedDummyMTC Tracking SheetMTC" & ThisFile
End Sub
The problem is when I place this code in 'ThisWorkbook' under BeforeSave I get the following error msg:
'Excel.exe has generated errors and will be closed by Windows. You will need to restart the program, an error log has been created'
does anyone know what I might be doing wrong?
Thanks