Page 1 of 1

Question about OLE, Word, Outlook and macros

Posted: Wed Sep 09, 2009 3:35 pm
by driessen
Hello,

I have often used OLE and Word in my application, sending commands to run macro's in Word, which works very well.

Code: Select all

oWord := TOleAuto():New("Word Application")
.....
oWord:Run("Macro")
 
Now, I try to use the same syntax to run a macro in Outlook.

Code: Select all

oOutLook   := CreateObject("Outlook.Application")
oNameSpace := oOutlook:GetNameSpace("MAPI")
...
oOutlook:Run("Macro")
 
Unfortunately, this always returns an error "Error Outlook Application/0 S_OK: Run".

What is the exact syntax to use macros for Outlook in FWH ?

Thanks a lot in advance for any help.

Re: Question about OLE, Word, Outlook and macros

Posted: Wed Sep 09, 2009 5:16 pm
by lailton.webmaster
Try:

oWord:Run:Macro() :lol:

or

oWord:Macro() :D

Re: Question about OLE, Word, Outlook and macros

Posted: Wed Sep 09, 2009 5:42 pm
by driessen
Thanks for your answer, but unfortunately the same error occurs.

I tried the different possibilities :

oOutlook:Run:Macro("Macro")
oOutlook:Run("Macro")
oMail:Run:Macro("Macro")
oMail:Run("Macro")

Any idea ?

Re: Question about OLE, Word, Outlook and macros

Posted: Wed Sep 09, 2009 7:05 pm
by lailton.webmaster
I will try use and return with my result.

Re: Question about OLE, Word, Outlook and macros

Posted: Wed Sep 09, 2009 7:33 pm
by lailton.webmaster
You need use:

oWordObject:Run( NameOfMacro )

later of NameOfMacro you can use too 30 vars, EXemplo oWordObject:Run( NameOfMacro, var1, var2, var3 ........... var30)

Only if you need of course :D

Re: Question about OLE, Word, Outlook and macros

Posted: Thu Sep 10, 2009 12:23 am
by driessen
Thanks a lot for trying to help me.

Your example works here too .... for Word.

The problem is that it doesn't work for Outlook.

But thanks anyway.

Re: Question about OLE, Word, Outlook and macros

Posted: Thu Sep 10, 2009 2:11 am
by lailton.webmaster
Driessen

I not found nothing inside of "MSOUTL.OLB" about Macro, and too dont have RUN

so i belive that OutLook dont have support this.