DASYLab

cancel
Showing results for 
Search instead for 
Did you mean: 

How to send a command to Excel using DDE

I am sending the current time to a number of cells in an Excel worksheet. When the task is complete, I want to send a Ctrl+j as a command to invoke a macro. Ctrl+j is an ASCII value 10 (CHR$10 in Basic). I set STR_10 to this value by using Ctrl+j and I tried using Alt+010. It appears to have accepted the character but you cannot see it like you would if it was a printable character like X or 7 or whatever.

 

I send the string at the end of the process using an Action module and a Message module. The Message module Option calls for Execute instead of Poke which I use to send the time stamps to the various cells. It seems like the message is not being sent as a command as it puts it in whatever cell the cursor was on.

 

Any ideas where I am going wrong?

 

Thanks in advance!

0 Kudos
Message 1 of 3
(5,511 Views)

DASYLab uses the \x notation for hex, so try \x10

 

I confess that I had very little luck sending commands to Excel via DDE, and have had much more luck using the Script module to talk to Excel. 

 

 

Measurement Computing (MCC) has free technical support. Visit www.mccdaq.com and click on the "Support" tab for all support options, including DASYLab.
0 Kudos
Message 2 of 3
(5,489 Views)

I tried \x10, \x0A and even ($0A). I don't see any reference to the \x in Help. Under the *.DDF help, there is reference to CTRL–M ($0D) and CTRL–Z ($1A). I would think that the string would be placed in the Message module but it is only in the Action module. In the Message module I have checked only Send message per DDE and in the Options, I have made the App be Excel, the Topic is SYSTEM and the Type is Execute. The Action module references Message00 on the Rising edge and the action is Send DDE message.

 

All of the above efforts send the string (X0A or $0A) to whatever cell the cursor is on, and unlike the Poke method, it puts the value in the cell but requires an Enter keystroke to continue. I actually have two events that occur on the rising edge and other action is delayed until the Enter key is pressed.

 

I did try modifying my Excel macro to loop until a given cell was not empty. The particular cell receives the last information from Dasylap and that is when I want the macro to execute the commands under the loop. It looped alright, looped and looped and looped! The sheet never did load and I had to shut Excel down with the Task Manager.

 

I also looked at a script example in Help and was pretty overwhelmed! Yikes.

0 Kudos
Message 3 of 3
(5,480 Views)