PDA

View Full Version : Opening Winword.exe and running VB macro.


Mike "the Rat"
08-28-2003, 10:30 AM
I'm recreating a production order form .mi drawings and pasting into MS Word (Winword.exe). I have the macro written to select the text from .mi and VB macro for word to paste and configure. Now I need to call up Winword.exe and run a macro that will automate the process.

I would image I would use DDE to call Winword.exe, does anyone have a example or could explain how I can call up MS Word and run a VB macro ?

Warm regards,
Mike "the Rat"

Mike "the Rat"
08-29-2003, 06:49 AM
I can now start MS Word from ME10. There can be no spaces within the path to the .exe program.

LET a (WINEXEC "C:\Progra~1\Micros~2\Office10\winword.exe")

You may have to change the "2" above to get the correct directory. It just so happens that I have five directories that start with "Micros".

Now, anyone know how to envoke a MS Word VB macro thru DDE_EXECUTE ?

I would image I would need to start a DDE connection with Word.
Then RUN the macro, DDE EXECUTE and finally end the connection.

Warm regards,
Mike "the Rat"

GiorgioL
09-01-2003, 06:43 AM
Try this.

let dde_ch (dde_initiate "winword" "system")
let ans (dde_execute dde_ch "[macro()]")
let clo (dde_close dde_ch)


where macro() is the name of your macro.

Regards. GiorgioL

GiorgioL
09-01-2003, 10:27 PM
Go to this address. You can find some information about dde comunication with winword. Of course you change a little to use in ME10 application.

http://support.microsoft.com/default.aspx?scid=kb;en-us;93657

Regards. GiorgioL.

Mike "the Rat"
09-02-2003, 05:42 AM
Thanks GiorgioL,
Works great now.
Thanks again, you have made my day !!!