Select different worksheet in Excel

For questions and postings not covered by the other forums
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Select different worksheet in Excel

Postby ConvertFromOldNGs » Fri Aug 07, 2009 1:14 pm

by Stevek >> Thu, 8 Nov 2007 6:01:52 GMT

Can anyone suggest (by example) how to code a switch in worksheet once an Excel object (workbook) has been created - with a default of 3 worksheets. I have a process that needs to generate 3 worksheets and while I can select the default (activeSheet), I cannot see how to activate the other sheets when required.

I can follow the logic in Excel when using Macros to see what MS does but cannot translate the process to jade coding.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Select different worksheet in Excel

Postby ConvertFromOldNGs » Fri Aug 07, 2009 1:14 pm

by Justin >> Mon, 24 Dec 2007 1:45:16 GMT

hope bolow example can help you,
//xl is Excel Activex object ,wBook is a Excel workbook
wBook := xl.workbooks.add(xl.XlWorksheet);
wBook.worksheets.add(xl.activeSheet,null, 2, null); //add 2 worksheet in current workbook
wBook.worksheets.p_Default("sheet2").I_Worksheet.activate() ;//"sheet2" is the sheet's name you want to actived


Regards,
Justin Chen


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 42 guests