Friday, August 31, 2012

Excel VBA Macro to Add, Open, Save a Workbook

Macro to Add, Open, Save a Workbook
Sub Add_Workbook()
Workbooks.ADD.SaveAs Filename:="C:\Documents and Settings\Administrator\My Documents\Test.xlsx" 'Creates A Workbook
Workbooks("A").Worksheets("AAA").Range("A1:Z65000").Copy

Workbooks.Open Filename:="C:\Documents and Settings\Administrator\My Documents\Test.xlsx" 'Opens An Existing Workbook
Workbooks("Test").Activate
Workbooks("Test").Worksheets("sheet1").Range("a1").PasteSpecial
Workbooks("Test").Save
Workbooks("Test").Close
End Sub

Thanks,Tamatam

No comments:

Post a Comment

Hi User, Thank You for visiting My Blog. Please post your genuine Feedback or comments only related to this Blog Posts. Please do not post any Spam comments or Advertising kind of comments which will be Ignored.

Featured Post from this Blog

How to compare Current Snapshot Data with Previous Snapshot in Power BI

How to Dynamically compare two Snapshots Data in Power BI Scenario: Suppose, we have a sample Sales data, which is stored with Monthly Snaps...

Popular Posts from this Blog