FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Question about OLE, Word, Outlook and macros
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Question about OLE, Word, Outlook and macros
Posted: Wed Sep 09, 2009 03: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 (fw): Select all Collapse
oWord := TOleAuto():New("Word Application")
.....
oWord:Run("Macro")

Now, I try to use the same syntax to run a macro in Outlook.
Code (fw): Select all Collapse
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. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 603
Joined: Sun May 04, 2008 08:44 PM
Re: Question about OLE, Word, Outlook and macros
Posted: Wed Sep 09, 2009 05:16 PM

Try:

oWord:Run:Macro() :lol:

or

oWord:Macro() :D

Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Question about OLE, Word, Outlook and macros
Posted: Wed Sep 09, 2009 05: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. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 603
Joined: Sun May 04, 2008 08:44 PM
Re: Question about OLE, Word, Outlook and macros
Posted: Wed Sep 09, 2009 07:05 PM

I will try use and return with my result.

Posts: 603
Joined: Sun May 04, 2008 08:44 PM
Re: Question about OLE, Word, Outlook and macros
Posted: Wed Sep 09, 2009 07: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

Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Question about OLE, Word, Outlook and macros
Posted: 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. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 603
Joined: Sun May 04, 2008 08:44 PM
Re: Question about OLE, Word, Outlook and macros
Posted: Thu Sep 10, 2009 02: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.

Continue the discussion