SaveCopyAs Method of Workbook Object VBA

‘SaveCopyAs’ method of workbook object is used to saves a copy of the workbook as a file but does not modify or change the open workbook. Please find the more information about SaveCopyAs Workbook method.

PREMIUM TEMPLATES LIMITED TIME OFFER

ON SALE80% OFF

50+ Project Management Templates Pack
Excel PowerPoint Word

Advanced Project Plan & Portfolio Template
Excel Template

Business Presentations Templates Pack
PowerPoint Slides

20+ Excel Project Management Pack
Excel Templates

20+ PowerPoint Project Management Pack
PowerPoint Templates

10+ MS Word Project Management Pack
Word Templates


Why we need SaveCopyAS in Workbook using VBA?

Sometimes we may want to save the workbook with changes and we don’t want to modify the opened workbook. So only we need to use ‘SaveCopyAs’ method of workbook object.

VBA SaveCopyAS Workbook – Syntax

Here is the example syntax to saves a copy of Workbook using VBA.

Workbooks(“Your Workbook Name”).SaveCopyAs(

[Filename])

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.

Sub Workbook_SaveCopyAs()
ThisWorkbook.SaveCopyAs ThisWorkbook.Name & "_Ver1"
End Sub

VBA SaveCopyAS Workbook – Instructions

  1. Open an Excel Workbook
  2. Press Alt+F11 to Open VBA Editor
  3. Insert a Module from Insert Menu
  4. Copy the above code for activating a range and Paste in the code window(VBA Editor)
  5. Save the file as macro enabled workbook
  6. Press ‘F5’ to run it or Keep Pressing ‘F8’ to debug the code line by line.
  7. You can find saved workbook in the following location: ThisWorkbook.Name & “_Ver1”.
LIMITED TIME OFFER

Leave A Comment


Related pages


copy worksheet vbahow to insert row in excelexcel datevalue functionexcel macro save as csvhow to change excel row to columnexcel color cellsunprotect excel spreadsheet 2010macros excel 2003delete row in excel vbavba save filebelajar ms access 2007excel delete row vbabase sas tutorial for beginnersmacro excel open filevba excel basicsvbscript nested ifcreate macros in excel 2007combobox excelmerge excel cellmultiple if statements excelvb file existsaverage function excel 2007excel vba sumifaccess vba insert recordset into tableexcel vba tablecreate pivot table vbaspotfire script examplesinsert multiple columns excelexcel macro merge cellsformulas of ms excel 2007 with examplesexcel vba cell valuevba timer functionexcel vba borderexcel how to delete duplicatesexcel vba goto sheetvba datedifffor loop step vbahow to collapse rows in excelexcel shotcutnested if excelhow do you merge cells in excel 2013call a function in vbamerging rows in exceldatevalue functioncoding macros in excelunprotect excel worksheet without passwordvba copy worksheet to new workbookvba excel create new workbookcopy worksheet to another workbookproject status report ppt templatelearn formulas in excelvba sql whereexcel sheet shortcutshow to add a new worksheet in excelvba programs for excelexcel query databasemerge and center excel 2010how to create userform in excel 2010excel worksheet columnsexcel vba documentationexcel vba windowsexcel vba column rangevba variable typesvba new linehow to unhide all tabs in excelvlookup in excel 2003vba positionexcel insert cellsvba msgbox examplehow to write vba code in excel 2010vba vlookup examplecell vbafile dialog vba