‘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.
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(
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
- 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”.
A Powerful & Multi-purpose Templates for project management. Now seamlessly manage your projects, tasks, meetings, presentations, teams, customers, stakeholders and time. This page describes all the amazing new features and options that come with our premium templates.
LIMITED TIME OFFER
Advanced Project Planning Templates
Excel Templates
120+ Project Management Templates Pack
Excel | PowerPoint | Word
ULTIMATE RESOURCE MANAGEMENT TEMPLATE
Excel Template
50+ Essential Project Management Templates
Excel | PowerPoint | Word
Project Portfolio Management Templates
Excel | PowerPoint Templates
50+ Excel Project Management Templates
Excel Templates
Share This Story, Choose Your Platform!
One Comment
Leave A Comment
You must be logged in to post a comment.
hi,
thanks but savecopy as method throws error when opening the backup copy of excel ,how to avoid this.