Hi All,
I haven't been on in awhile, I hope everyone is doing well.
Using VFP 9, I'm trying to select multiple worksheets in an Excel spreadsheet.
For example:
* Create Instance
oExcel=CreateObject('Excel.Application')* Open the spreadhsheet
oWorkBook=oExcel.Workbooks.Open("MyExcelWorkbook.xls")Now, If I wanted to select a single worksheet "Sheet 1", for example (and have it be the active worksheet), I can issue this:
oWorkbook.Sheets("Sheet 1").SelectHowever, I can't quite get the syntax for selecting more than one worksheet. As I usually will do, I created a macro to see what the VBA code would look like... To select 2 worksheets, this is what the macro looked like:
Sheets(Array("Sheet 1", "Sheet 2")).SelectUnforunately, that won't work in VFP ("Array not a program" error). (And before anyone suggests it,
oWorkbook.Sheets(Array("Sheet 1", "Sheet 2")).Select doesnt work either. :-)
Any suggestions would be appreciated. In the past, I've always relied on Tamar's book (
MS Office Automation with Visual FoxPro, Hentzenwerke Publishing), but in this particular case, I can't figure out how to replicate the VBA syntax in VFP.
Thanks,