OLE, Word and Outlook

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

OLE, Word and Outlook

Post by driessen »

Hello,

I use this code to position Word on my screen:

Code: Select all

oWord:Top    := US->UWORDTOP
oWord:Left   := US->UWORDLEF
oWord:Width  := US->UWORDWID
oWord:Height := US->UWORDHEI
I also us this code to make Word visible:

Code: Select all

oWord:Visible := .T.
This is also working likewise for Excel.

But why isn't it working for Outlook? How can I postion my Outlook on my screen in FWH?

Thanks a lot in advance.
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
User avatar
driessen
Posts: 1239
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: OLE, Word and Outlook

Post by driessen »

Nobody?
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
User avatar
gkuhnert
Posts: 274
Joined: Fri Apr 04, 2008 1:25 pm
Location: Aachen - Germany // Kerkrade - Netherlands
Contact:

Re: OLE, Word and Outlook

Post by gkuhnert »

There simply is no Application.Visible property implemented by Microsoft. You just have to define an explorer. For example, if you want to show the inbox folder in Outlook you could implement:

Code: Select all

static function ShowInbox()
local oNameSpace, oInbox
local oExplorer
    oOutlook := GetOutlookObject()
    IF oOutlook == nil
        return {}
    ENDIF
    oNameSpace := oOutlook:Get( "GetNameSpace", "MAPI" )
    oInbox := oNameSpace:Get( "GetDefaultFolder", 6 ) // Enumeration: https://msdn.microsoft.com/en-us/vba/outlook-vba/articles/oldefaultfolders-enumeration-outlook
    oExplorer := oOutlook:Explorers():Add(oInbox, 0) // Enumeration: https://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.olfolderdisplaymode.aspx
    oExplorer:Activate()
return nil

static function GetOutlookObject()
local oOutlook
    TRY
        oOutlook := GetActiveObject ( "Outlook.Application" )
    CATCH
        TRY
        oOutlook := CREATEOBJECT( "Outlook.Application" )
        CATCH
                MsgStop("Cannot start outlook!")
                return .f.
            END
        END
    ENDIF
return oOutlook
 
Properties Top, Left, Height and Width are available to the explorer-object:
https://msdn.microsoft.com/VBA/Outlook- ... ct-outlook
Best Regards,

Gilbert Kuhnert
CTO Software GmbH
http://www.ctosoftware.de
Post Reply