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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DDE with Excel

Status
Not open for further replies.

Riegg

Programmer
Mar 20, 2003
29
CA
Can I make a script do a save as/open with a string var??

i.e.: ddeexecute systemvar "[save.as(filename)]"
 
ok here is what I have done:

filename = "`"[open(`""
strcat filename sdirectory
strcat filename sfile
strcat filename "`")]`""
ddeexecute systemvar filename
pause 1

That works but if I do filename = "`"[save.as(`"", it won't work??
 
The following string passed to Excel via DDE will properly execute the save.as macro comand. Note that the filename has quotes around it.

[SAVE.AS("testsave.xls")]

So, the following SHOULD work via Aspect.

macrostring="[SAVE.AS(`"testsave.xls`")]"
ddeexecute systemvar macrostring

For some excellent general DDE info, look here:

To get a copy of the Macro97 help file, look here:

If you don't have the Macro97 help file already, I HIGHLY recommend grabbing a copy. It really opens up the doors to what you can do with Excel via DDE.


Note: I did not test this via Aspect, but used Python's interactive interpreter with the DDE module loaded as it returns the results immediately. It provides a nice real time test. The only problem I encountered was when the quotes were omitted.
 
Thanks for the help, I missed the fact that I was using the wrong DDE ch (it was linked to the sheet tab not to system) once I changed that all my problems went away.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top