Question about OLE, Word, Outlook and macros

Post Reply
User avatar
driessen
Posts: 1239
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Question about OLE, Word, Outlook and macros

Post 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.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
lailton.webmaster
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Question about OLE, Word, Outlook and macros

Post by lailton.webmaster »

Try:

oWord:Run:Macro() :lol:

or

oWord:Macro() :D
User avatar
driessen
Posts: 1239
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Question about OLE, Word, Outlook and macros

Post 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 ?
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
lailton.webmaster
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Question about OLE, Word, Outlook and macros

Post by lailton.webmaster »

I will try use and return with my result.
lailton.webmaster
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Question about OLE, Word, Outlook and macros

Post 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
User avatar
driessen
Posts: 1239
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Question about OLE, Word, Outlook and macros

Post 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.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
lailton.webmaster
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Question about OLE, Word, Outlook and macros

Post 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.
Post Reply