Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Plug Existing Excel Cell with Table info
Message
De
21/07/2002 22:37:25
Nancy Folsom
Pixel Dust Industries
Washington, États-Unis
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00680666
Message ID:
00680982
Vues:
15
>How can I write code that will place field values in specific excel-sheet locations ?
>
>The existing Excel spreadsheet must be used.

Do you mean a spreadsheet that is currently open in Excel? You can get a reference to an instance of Excel with:
o=GETOBJECT('','excel.application')
but I'm blank on how you can get a handle to the open workbook. However, you'd have trouble writing to it (since it's already open). You could, instead, create a COM addin that would install in Excel. Garrett Fitzgerald gave a demo of this technique to the Seattle FoxPro User Group last Monday with regard to Mappoint, but the concept should work for Excel. See http://support.microsoft.com/default.aspx?scid=kb;en-us;Q290868.

>Follow up question...
>What's the code to read values from specific sheet cells?

Short answer
o=CREATEOBJECT('excel.application')
o.Workbooks.Open(GETFILE('XLS'))
?o.Workbooks(1).Worksheets(1).cells(1,1).value
o.Workbooks(1).Worksheets(1).cells(1,1).value = 'foobar'
?o.Workbooks(1).Worksheets(1).cells(1,1).value
As an aside, you might want to look into getting:
http://www.hentzenwerke.com/catalogavailability/autofox.htm
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform