Monday 20 May 2013

How to Create a New Excel Workbook using VBA Macro

Below Code/Example can be used to create a new Excel workbook and save it using VBA Macro.

Syntax and Example of VBA Macro to Create a new workbook:

Sub AddNewWorkbook()
      Set WB = Workbooks.Add
      WB .Title = "New WB"
      WB   .SaveAs Filename:="D:\MYNEWFile.xls"    
End Sub


Above code will create a new workbook with title as New WB and It will Save the new Workbook to location D:\MYNEWFile.xls

No comments:

Post a Comment

Popular Posts

Search This Blog