KickingitCrazy
New Member
- Joined
- Jan 1, 2021
- Messages
- 2
- Office Version
- 365
- 2019
- 2016
- Platform
- Windows
I want to the workbook to SaveAs (1) a specific value in cell (2) allow user to change where the workbook is saved and (3) without closing the workbook. I'm very new to using Macros, I just Google codes and use them.
I keep getting an error on line 7 "ActiveWorkbook.SaveAs FileName:=Path & FileName, FileFormat:=xlOpenXMLWorkbookMacroEnabled" I'm not sure what to do about this error, I've tried a couple different things but no success. I'm sure the error is above my knowledge level. If you could also provide some direction on how to resolve my (2) and (3) issues, I'd appreciate.
Code:
Sub FileNameAsCellContent()
Dim FileName As String
Dim Path As String
Application.DisplayAlerts = False
Path = "C:\Users\Username\"
FileName = Range("B60").Value & ".xlsm"
ActiveWorkbook.SaveAs FileName:=Path & FileName, FileFormat:=xlOpenXMLWorkbookMacroEnabled
Application.DisplayAlerts = True
ActiveWorkbook.Close
End Sub
I already have two other macros on the sheet as buttons, spellcheck and email. Those both work fine.
I keep getting an error on line 7 "ActiveWorkbook.SaveAs FileName:=Path & FileName, FileFormat:=xlOpenXMLWorkbookMacroEnabled" I'm not sure what to do about this error, I've tried a couple different things but no success. I'm sure the error is above my knowledge level. If you could also provide some direction on how to resolve my (2) and (3) issues, I'd appreciate.
Code:
Sub FileNameAsCellContent()
Dim FileName As String
Dim Path As String
Application.DisplayAlerts = False
Path = "C:\Users\Username\"
FileName = Range("B60").Value & ".xlsm"
ActiveWorkbook.SaveAs FileName:=Path & FileName, FileFormat:=xlOpenXMLWorkbookMacroEnabled
Application.DisplayAlerts = True
ActiveWorkbook.Close
End Sub
I already have two other macros on the sheet as buttons, spellcheck and email. Those both work fine.