Hi guys,
I need a VBA code that will resave my workbook on my desktop (regardless of user) and switch to xlsx format (macros disabled), and rename the workbook with text and a date pulled from a cell value (BC2). Below is the code I have so far but it does not seem to work (error shown in image below). If someone could please fix this for me that would be great. It would also be nice if it continued to close the current workbook and then opened the newly saved one. Thanks
I need a VBA code that will resave my workbook on my desktop (regardless of user) and switch to xlsx format (macros disabled), and rename the workbook with text and a date pulled from a cell value (BC2). Below is the code I have so far but it does not seem to work (error shown in image below). If someone could please fix this for me that would be great. It would also be nice if it continued to close the current workbook and then opened the newly saved one. Thanks
VBA Code:
Sub Resave()
Dim FileName As String
Dim Path As String
Application.DisplayAlerts = False
Path = "C:\users\" & Environ("Username") & "\Desktop"
FileName = "BCA Daily All Arrivals " & ActiveWorkbook.Sheets("MASTER").Range("BC2")
ActiveWorkbook.SaveAs Path & FileName, xlOpenXMLWorkbook
Application.DisplayAlerts = True
ActiveWorkbook.Close
End Sub