From the course: Excel VBA: Managing Files and Data

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Save a workbook under a new name

Save a workbook under a new name - Microsoft Excel Tutorial

From the course: Excel VBA: Managing Files and Data

Start my 1-month free trial

Save a workbook under a new name

- [Instructor] When you automate processes in Excel, you will often want to save the file you're working on under a new name or in a new location. In this movie, I will show you how to do that in Excel VBA. My sample file is 0206 SaveAs. That's a macro enabled workbook that you can find in the chapter two folder of your exercise files collection. I don't need to work with the data in the workbooks worksheet. So I'll press alt + F11 to move to the visual basic editor. And here, you see I have a code module already set up with a sub-routine and two lines of code that are commented out. I'll get to those in a minute, but I'll add the code that we need to save the active workbook under a new file name, in between them. So I'll click in between my two commented lines of code. The object we want to work with is the active workbook. So I'll type active workbook. And the method we'll use after the dot is SaveAs, no surprise…

Contents