REAL-TIME

VBA Projects

Full Access with Source Code
  • Designed and Developed by PNRao

  • Full Access with VBA Source Code

  • Well Commented Codes Lines

  • Creative and Professional Design

Effortlessly
Manage Your Projects

120+ Project Management Templates

Seamlessly manage your projects with our powerful & multi-purpose templates for project management.

120+ PM Templates Includes:
  • 50+ Excel Templates

  • 50+ PowerPoint Templates

  • 25+ Word Templates

Share Post

Description:

Sometimes we may want to open or create new workbook using VBA.You can set the newly created workbook to an object, so that it is easy to refer to your workbook to do further tasks.

Solution(s):

The following Macros will allow to open or create new workbook using Add method.

Create New Workbook in Excel VBA – Example Cases:

Create new workbook

You can use the following code to create new Workbook and save in the C drive using Add method.

Code:
Sub AddNewWorkbook1()

	'Adding New Workbook
	Workbooks.Add

	'Saving the Workbook
	ActiveWorkbook.SaveAs "C:WorkbookName.xls"

	'OR
	ActiveWorkbook.SaveAs Filename:="C:WorkbookName1.xls"

End Sub

Explanation:
  1. Workbooks.Add method will add a new workbook
  2. ActiveWorkbook.SaveAs method will save the active workbook to a specific location with specified File name
Output:

You should see newly opened workbook along with existing workbook.
Create new Workbook

Instructions:
  1. Open an excel workbook
  2. Press Alt+F11 to open VBA Editor
  3. Insert a new module from Insert menu
  4. Copy the above code and Paste in the code window
  5. Press F5 to see the output
  6. You should see newly opened workbook as shown above
  7. Save the file as macro enabled workbook
Create an object for newly created workbook

You can set the newly created workbook to an object, so that it is easy to refer to your workbook to do further tasks.

Code:
sub AddNewWorkbook2()

	Dim wkb as Workbook

	'Adding New Workbook
	Set wkb = Workbooks.Add

	'Saving the Workbook
	wkb.SaveAs "C:WorkbookName.xls"
	'OR

	wkb.SaveAs Filename:="C:WorkbookName1.xls"</span></code>

End Sub

Output:

You should see newly opened workbook along with existing workbook.

Instructions:
  1. Open an excel workbook
  2. Press Alt+F11 to open VBA Editor
  3. Insert a new module from Insert menu
  4. Copy the above code and Paste in the code window
  5. Press F5 to see the output
  6. You should see newly opened workbook as shown above
  7. Save the file as macro enabled workbook
Effortlessly Manage Your Projects and Resources
120+ Professional Project Management Templates!

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.

Save Up to 85% LIMITED TIME OFFER
Project Management Templates

All-in-One Pack
120+ Project Management Templates

Essential Pack
50+ PM Templates

Excel Pack
50+ Excel PM Templates

PowerPoint Pack
50+ Excel PM Templates

MS Word Pack
25+ Word PM Templates

Ultimate Project
Management Template
Ultimate Resource
Management Template
Project Portfolio
Management Templates
Categories: Excel VBATags: Last Updated: June 17, 2022

3 Comments

  1. ow.ly March 8, 2014 at 1:10 AM

    Thank you for sharing your info. I really appreciate your efforts and I am waiting for your next write ups thank you once again.

  2. Ed March 3, 2016 at 8:51 AM

    Can you show how to use the ‘template’ option when you .Add

  3. chandru April 15, 2019 at 9:28 PM

    i have multiple excel .

    all the excel combined one excel and saved given path , excel name date format .

    could you please given code

Leave A Comment