Many thanks to Riouxnick for this pointer. 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.
************************************************** ******