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


xml to excel converterrefresh worksheet vbavba application.enableeventsnested if and statements excelcsv converter to excelhow to make drop down in excel 2007vba named rangesprotect worksheetms access delete duplicate recordshow do you delete extra pages in excelvba array exampleproject planning template excel gantt chartvba range cellstechnical aptitude questions with answersvba odbcpm schedule excel templateexcel vba create new worksheetexcel.application.workbooks.openexcel macro hotkeyclose word document vbaexcel macros programmingexcel dashboard tutorialexcel hide a columnexcel vba data validationbuilding a macro in excelvlookup in excel 2010 examplemacro programming in excelexcel formula to calculate difference between two datesvb6 write text fileexcel unhide sheetsunlock excel spreadsheet without passwordhow to lock a spreadsheethow to use sumifs function in excel 2010workbooks excelvlookup examples in excel 2007sumif excelvba selection endvba code for excelmerging excel cellsunprotect excel workbook vbavbscript filesystemobject methodsportfolio management dashboard exceldynamic excel chart titlevba select case statementcreate excel drop down list 2007hlookup in excel 2010hr interview questions indiabixtemplate checklist excelrecording minutes of a meeting templatevlookup returns 0lookup excel exampledaily scrum meeting templatevba code to connect to sql serverfor loop in macro exceltask tracker excel templateend xlupexcel nested if limitwhat is meant by vlookupmicrosoft excel test for interviewmultiselect listboxhow to remove duplicates in excel 2010vba isnumbervba excel programmingexcel macro progress baredit macro in excelexcel userform listboxprotect vbaexcel button for macrovba listbox multiple columnsmsgbox exampleshyperlink in vbahide rowsmessage in vbavb gotoexport data from access to excel using vbahide worksheets in excel3d graphing excelcount columns excel