Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Reading EXCEL Macros
Message
 
À
18/10/1999 09:49:47
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00277641
Message ID:
00277669
Vues:
34
>Hello all. I posted a message a bit ago regarding where to find info on the syntax of writing automated reports from FoxPro 5.0 to Excel 5.0. One bit of advice I got was to simply run a Macro in Excel and then use that in my foxPro code. This NORMALLY works like a charm, but there are some functions where the syntax doesn't exactly mesh with foxPro. My most recent problem is in trying to MOVE excelsheets within a workbook. The macro is as follows:
>Sheets("NORTHEAST").Select
>Sheets("NORTHEAST").Move Before:=Sheets(9)
>I noticed then, if I issue the statement:
> excelObject.Sheets("NORTHEAST").Move
>by itself, it moves the sheet "NORTHEAST" into its own new workbook. Does anyone know the syntax for moving a sheet to a specific place within the current workbook?

Paul, according to VBA help "Before" must be an object reference, not the numeric value.

So, if you do

oWorkbook =YourExcelObject.ActiveWorkbook
*** moving worksheet3 before worksheet1
oBefore = oWorkbook.Sheets(1)
oWorkbook.Sheets(3).Move(oBefore)

you will get it.

Nick
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform