Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Putting info in Excel
Message
 
À
22/06/1999 11:18:15
Information générale
Forum:
Visual FoxPro
Catégorie:
FoxPro 2.x
Divers
Thread ID:
00232500
Message ID:
00232534
Vues:
26
>>Hi Denise,
>>
>>You'd have to use DDE in 2.6. It's fairly straightforward, however. I have some code that might be of help. Let me know if you'd like some examples.
>
>Hi George,
>
>I have a feeling I might be getting in over my head -- but that's the only way I'll learn. :) What's DDE? Yes, I surely would like some examples. You can send them to denise.duggan@dot.state.fl.us Thanks.

Hi Denise,

DDE stands for Dynamic Data Exchange. It allows DDE enabled applications to pass information back and forth. AFAIK, it uses Windows messaging services to accomplish this. Since FPW doesn't have the ability to create an object reference to Excel, this would be the way to proceed.

I don't have much in the way of examples to send, but what I can do is post one or two to get you started, plus some notes that might be helpful. First, here's a simple code snippet that inserts a two values and a formula into an Excel sheet.
mchannum = DDEInitiate('Excel', 'Sheet1')
IF mchannum > -1
  * Insert a value into cell A1
  = DDEPoke(mchannum, 'R1C1', '20') && Row 1/Column 1
  * Insert a value into cell A2
  = DDEPoke(mchannum, 'R2C1', '30') && Row 2/Column 1
  * Insert a formula into cell A3
  = DDEPoke(mchannum, 'R3C1', '=A1+A2') && Row 3/Column 1
  = DDETerminiate(mchannum)
ENDIF
A couple of notes. I'd first test to see if Excel were already open using my Is_Run() function that's available in the UT download section under Win32 and Other APIs. The file contains both 16 and 32 bit versions. If it isn't running, I'd use ShellExecute to start it minimized. Be happy to provide a sample for that if you need it.

If the file is a workbook you'll have to establish the DDE channel with the particular page of the workbook in order for this to work properly. Since most of my work with DDE was done with Lotus, I don't have too much that would apply to Excel. I do have some that can help with selecting the page, however. Let me know if it's needed.

hth,
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform