Activate Send/Receive dialog box programmatically

  • Thread starter Thread starter Amin Sobati
  • Start date Start date
A

Amin Sobati

Hi,
I need to activate Send/Receive dialog box of outlook(2000) from within my
app(vb6) to force outlook send emails when connection is available.
Any help would be greatly appreciated.
Regards,
Amin
 
Simulating a click on the Send/Receive button is probably your best bet:

Set Btn = OutlookApplication.ActiveExplorer.CommandBars.FindControl(1, 5488)
Btn.Execute

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Dmitry,
Thank you! It was great tip. But what if outlook is not open? My code is
something like this:

Dim OA As Outlook.Application
Set OA = New Outlook.Application
Set Btn = OA.ActiveExplorer.CommandBars.FindControl(1, 5488)

When outlook is not open, I get error 91 on the third line:
"Object variale or with block variable not set."

Amin
 
Check if Application.Explorers = 0, then get a folder (any folder, such as
Namespace.GetDefaultFolder(olFolderInbox)), then call MAPIFolder.Display.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Thanks Dmitry!
I wrote something like this:
Dim olMAPI As NameSpace
Dim ex As Explorer
Dim curInbox As MAPIFolder
Set olMAPI = Application.GetNamespace("MAPI")
Set curInbox = olMAPI.GetDefaultFolder(6)
Set ex = curInbox.GetExplorer
Set Btn = ex.CommandBars.FindControl(1, 5488)
Btn.Execute

It works fine :)
Amin
 
Back
Top