View Single Post
  #2 (permalink)  
Old July 17th, 2003, 03:06 PM
spotts-71 spotts-71 is offline
Authorized User
 
Join Date: Jun 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have just been pointed to http://www.freevbcode.com/ShowCode.Asp?ID=2139

Rather than writing in VB, I am in fact using Visual FoxPro, so have found that the example text pointed to needed some modifications.

In case anyone is wondering, here is the solution that I found to work:
************************************************** ******
LOCAL loOutlook, loCommandBarCollection, loStandardCB
*
loOutlook = CREATEOBJECT("outlook.application")
*
= loOutlook.GetNameSpace("MAPI").GetDefaultFolder(6) .GetExplorer && Make sure that a mail folder (I have chosen the Inbox) is active, even if still hidden - as one can't Send/Receive from say a Notes folder
*
loCommandBarCollection = loOutlook.ActiveExplorer.CommandBars
FOR x = 1 TO loCommandBarCollection.Count
    IF PADR(UPPER(loCommandBarCollection.Item(x).Name), 10) = "STANDARD "
        loStandardCB = loCommandBarCollection.Item(x)
        EXIT
    ENDIF
ENDFOR
IF TYPE("loStandardCB") # "O" && Just incase the Standard toolbar can't be found
    RETURN .F.
ENDIF
= loStandardCB.Controls("Send/Receive").Execute
RETURN .T.
************************************************** ******