Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automation with Excel Multiple Worksheets

Status
Not open for further replies.

campbere

Technical User
Oct 10, 2000
146
US
I have a 6.0 VB application that sends information out to an Excel Workbook. I have been able to automate the process as long as I know the number or worksheets I need. However now I need to learn how to use the VB OLE Automation to create X amount of worksheets.

Each time the report is ran the number of worksheets can be different. For example this report grabs all the products, and their relevant information that are currently in production. For each unique product it's data should be on a seperate worksheet.

I have not figured out how to do this dynamically. Can someone give me some hints or push me in the right direction?

Thank You
 
You can simply add a new worksheet avery time you need:

Dim newWorksheet as Excel.Worksheet
Dim myWorkbook as Excel.Workbook

...

set newWorksheet = myWorkbook.Sheets.Add

or something like that...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top