Question : SendObject doesn't send the email.

My company's default implementation of MS Outlook is such that when a user opens Outlook, they are prompted to "connect to the server using the network or work offline or cancel this logon."
If my MS Access code runs DoCmd.SendObject while Outlook is not open, the user is prompted with this same message, and if they choose WorkOffline or Cancel, then Outlook doesn't open, the email is not sent, and no run time error is generated to indicate to Access that the message was not sent.

Can I open MS Outlook from Access and select the 'Connect' option using automation, in case Outlook is not open?

Answer : SendObject doesn't send the email.

Does this work with your server.

Basically if the GetObject throws an error then Outlook is closed.  So the Createobject is used.  Then you use the Logon.

Here is the reference, in case you need a profile or password.

http://msdn.microsoft.com/en-us/library/aa220124(office.11).aspx

I have only needed to use this once and I left both password and profile blank.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
 
Dim olApp As Outlook.Application
Dim oNS As Outlook.Namespace 
On Error resume next 
Set olApp = GetObject(, "Outlook.Application") 
  If Err.Number = 429 Then
      Set olApp = CreateObject("Outlook.Application")
       Set oNS = olApp.GetNamespace("MAPI")
        oNS.Logon "", "", False, True
  End if
Random Solutions  
 
programming4us programming4us