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?
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
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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.