Question about OLE, Word, Outlook and macros

Question about OLE, Word, Outlook and macros

Postby driessen » Wed Sep 09, 2009 3:35 pm

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  Expand view
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  Expand view
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. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Question about OLE, Word, Outlook and macros

Postby lailton.webmaster » Wed Sep 09, 2009 5:16 pm

Try:

oWord:Run:Macro() :lol:

or

oWord:Macro() :D
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Question about OLE, Word, Outlook and macros

Postby driessen » Wed Sep 09, 2009 5:42 pm

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. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Question about OLE, Word, Outlook and macros

Postby lailton.webmaster » Wed Sep 09, 2009 7:05 pm

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

Postby lailton.webmaster » Wed Sep 09, 2009 7:33 pm

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
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Question about OLE, Word, Outlook and macros

Postby driessen » Thu Sep 10, 2009 12:23 am

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. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Question about OLE, Word, Outlook and macros

Postby lailton.webmaster » Thu Sep 10, 2009 2:11 am

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.
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 86 guests