Where Filename: It is an Optional parameter. It will specifies the workbook name to save the copy. But to avoid problems always better to declare the filename. Because if it uses the current file name to save the file in the current folder since the workbook might be open.
VBA SaveCopyAS Workbook:Example 1
Please find the below example, It will show you saveCopyas workbook method.
ThisWorkbook.SaveCopyAs ThisWorkbook.Name & "_Ver1"
VBA SaveCopyAS Workbook – Instructions
- Open an Excel Workbook
- Press Alt+F11 to Open VBA Editor
- Insert a Module from Insert Menu
- Copy the above code for activating a range and Paste in the code window(VBA Editor)
- Save the file as macro enabled workbook
- Press ‘F5’ to run it or Keep Pressing ‘F8’ to debug the code line by line.
- You can find saved workbook in the following location: ThisWorkbook.Name & “_Ver1”.