Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Syntax for Selecting Multiple Worksheets in Excel Using VFP
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Syntax for Selecting Multiple Worksheets in Excel Using VFP
Divers
Thread ID:
01142827
Message ID:
01142827
Vues:
193
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").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.

Thanks,
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform