Quantcast
Viewing all articles
Browse latest Browse all 3066

Sending a email and SENT property

Hi , I´m newbie with VBA and can´t find out why the following code is not updating the SENT property ...

I´m testing as EXCEL 2010 macro, after Outlook is open I send the email and seems SENT is not updated !

Sub outlook()

  Dim oout As Object
  Dim omsg As Object

  Set oout = CreateObject("Outlook.Application")
  Set omsg = oout.CreateItem(olMailItem)
  Set myRecipient = omsg.Recipients.Add(" JOHN ")
  omsg.Subject = "Teste Objeto Outlook no Macro Excel"
  omsg.Display
  If omsg.Sent Then
     MsgBox (" Sent ")
  Else
     MsgBox (" Not Sent ")
  End If
  Set oout = Nothing
  Set omsg = Nothing
 End Sub

Thanks,

Hu


Viewing all articles
Browse latest Browse all 3066

Trending Articles