Hi Sergey,
Thanks for the suggestion, that did the trick. Thank you so much for the information and assistance.
You know, I originally joined the UT back in 1997 and over the years it has proven to be a huge help! While I don't do much in VFP anymore (focusing more on sales and not as much development), I knew that posting my question here would yield a solution. You're a good man!
Thanks again, I genuinely appreciate it. :-)
Patric
>Try
>DIMENSION laSheets[2]
>laSheets[2] = "Sheet2"
>laSheets[1] = "Sheet1"
>oWorkbook.Sheets(@laSheets).Select
>
>>
>>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").Select>>
>>However, 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")).Select>>
>>Unforunately, 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.