VBA SaveAs Workbook is to Save changes to the workbook. And save workbook as a different Workbook file using SaveAs method of Workbook object. Workbook is a part of workbooks collection.
Syntax for SaveAs Workbook Method
Here is the following syntax to SaveAs Workbook.
expression.SaveAs([FileName], [FileFormat], [Password], [WriteResPassword], _ [ReadOnlyRecommended], [CreateBackup], [AccessMode As XlSaveAsAccessMode = xlNoChange], _ [ConflictResolution], [AddToMru], [TextCodepage], [TextVisualLayout], [Local])
Where expression is a required parameter. It represents Workbook object which is part of workbooks collection.
All other parameters are optional parameters.
Macro to Save Workbook as Different Workbook in Excel VBA
Let us see the following example. It Saves workbook as a different Workbook file.
'VBA SaveAs Workbook in Excel Sub VBA_SaveAs_Workbook() 'Variable declaration Dim oWorkbook As Object 'Create new workbook Set oWorkbook = Workbooks.Add 'Save Workbook as different Workbook file ActiveWorkbook.SaveAs Filename:="D:\VBAF1\New_File.xlsx" End Sub
Instructions to Run VBA Macro Code or Procedure:
You can refer the following link for the step by step instructions.
Instructions to run VBA Macro Code
Other Useful Resources:
Click on the following links of the useful resources. These helps to learn and gain more knowledge.
VBA Tutorial VBA Functions List VBA Arrays in Excel Blog
VBA Editor Keyboard Shortcut Keys List VBA Interview Questions & Answers