Page 1 of 1
OLE, Word and Outlook
Posted: Sat Apr 15, 2017 2:10 pm
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:
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.
Re: OLE, Word and Outlook
Posted: Tue Apr 18, 2017 8:44 am
by driessen
Nobody?
Re: OLE, Word and Outlook
Posted: Mon Jul 17, 2017 1:31 pm
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