Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Plug Existing Excel Cell with Table info
Message
From
21/07/2002 22:37:25
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00680666
Message ID:
00680982
Views:
16
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform