Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can procomm run an excel macro

Status
Not open for further replies.

hawk1996

Technical User
Mar 1, 2004
15
US
Is there a way to have a procomm script run an excel macro?
I can get it to open an excel worksheet by using the run command, but can it also run a specific macro?

Thanks
 
Here is a sample script that shows how to run a macro called Macro1:

proc main
long LinkVar, SystemVar ;Variables containing DDE Id's.

;Set up DDE links to Excel's system and a spreadsheet. Excel
;must be running in order for this script to work properly.
if ddeinit SystemVar "excel" "system"
ddeexecute SystemVar "[FULL(TRUE)]" ;Maximize the spreadsheet.
if ddeinit LinkVar "excel" "sheet1" ;Set up link to spreadsheet.
ddeexecute LinkVar "[RUN(`"Macro1`")]"
ddeterminate LinkVar ;Break DDE link to spreadsheet.
ddeterminate SystemVar ;Break DDE link to Excel.
else
errormsg "Couldn't establish DDE link to spreadsheet!"
endif
else
errormsg "Couldn't establish DDE link to Excel!"
endif
endproc

 
Thanks, that works great. One other question, can you have procomm yield until the macro finishes.
 
Unfortunately, I don't know if this can be done since it is not clear to me if Procomm waits for the DDE server to return its status, or if Procomm posts success when it sends the message to the server.


 
Thanks anyway knob, I'll just put a usermsg in there telling the user to wait until the macro finishes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top