Mackeral
Board Regular
- Joined
- Mar 7, 2015
- Messages
- 249
- Office Version
- 365
- Platform
- Windows
This is the code:
Path = "E:\Mac's Data\Mac's Docs on E\Computer\Excel\Spread Sheets\Data Entry"
and when I look at it in File Explorer I get
_______E:\Mac's Data\Mac's Docs on E\Computer\Excel\Spread Sheets\Data Entry
File_Name = "Data Entry (Q).xlsm" and is a new file name.
When I run the code I get an Error 9 (Subscript out of range)
When I run this code via Record Macro
it works.
So whats going on here. Thanks for any help you can give.
Code:
Sub Workbook_Save(Path, Workbook_Name, _
Optional File_Format As XlFileFormat = xlOpenXMLWorkbookMacroEnabled)
' Save the workbook to the indicated file.
If Right(Path, 1) <> "\" Then Path = Path & "\"
FileName = Path & Workbook_Name
Workbooks(Workbook_Name).SaveAs _
FileName:=FileName, _
FileFormat:=File_Format, _
CreateBackup:=False
End Sub ' Workbook_Save()
Path = "E:\Mac's Data\Mac's Docs on E\Computer\Excel\Spread Sheets\Data Entry"
and when I look at it in File Explorer I get
_______E:\Mac's Data\Mac's Docs on E\Computer\Excel\Spread Sheets\Data Entry
File_Name = "Data Entry (Q).xlsm" and is a new file name.
When I run the code I get an Error 9 (Subscript out of range)
When I run this code via Record Macro
Code:
ActiveWorkbook.SaveAs FileName:= _
"E:\Mac's Data\Mac's Docs on E\Computer\Excel\Spread Sheets\Data Entry\Data Entry.xlsm" _
, FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
So whats going on here. Thanks for any help you can give.