Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem to define number of worksheets in Excel 97
Message
De
22/09/2001 11:45:57
 
 
À
21/09/2001 21:48:33
Peter Wagner
Point Informática Ltda.
Limeira, Brésil
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00559588
Message ID:
00559654
Vues:
15
This message has been marked as the solution to the initial question of the thread.
>I need to transfer some data to Excel
>and I'm having problems to define the number of
>Worksheets a workbook contains.
>
>I use this code:
>oExcel = CREATEOBJECT("Excel.Application")
>oExcel.SheetsInNewWorkbook = 4 && Problem in Excel 97
>
>In Excel 2K it works fine, but in Excel 97 it returns:
>OLE error code 0x80010105 The server emited an exception
>is it a bug, is there a workaround, then I want to be sure
>that the are enough Worksheets to work.
>
>I know that I can add a new worksheet, but how can I know
>how many sheets are in the workbook before open the necessary
>worksheets ?
>
>TIA
>
>Peter

Works fine for me, I tested on Excel 97 SR-2. You can find out how many worksheets there are in the current workbook by looking at the Count property of the sheets collection:
? oExcel.ActiveWorkbook.Sheets.Count
If there aren't enough then you can Sheets.Add() to the workbook. HTH
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform