Hello,
I have now switched to the New Outlook, but the VBA code I use for sending emails to people appears not to work. I have been looking into this for weeks now and can't find a solution. Does anyone know how to fix this please?
Please see my VBA code below.
Thanks in advance. Kind regards,
Johno
Dim EmailAddr As String, OutApp As Object, OutMail As Object, strbody As String Dim WSHnet As Object Dim OL As Object, olAllUsers As Object, oExchUser As Object, oentry As Object, User As String Set WSHnet = CreateObject("WScript.Network") Set OL = CreateObject("outlook.application") Set olAllUsers = OL.Session.AddressLists.Item("All Users").AddressEntries User = OL.Session.CurrentUser.Name Set oentry = olAllUsers.Item(User) Set oExchUser = oentry.GetExchangeUser() EmailAddr = "" Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(0) strbody = "Hello. This is my email. " & vbNewLine & vbNewLine & _ "Regards," & vbNewLine & vbNewLine & _ "Me" With OutMail EmailAddr = 'myemailaddress' .To = EmailAddr .Subject = " Example Email" .Body = strbody .Send End With On Error GoTo 0 Set OutMail = Nothing Set OutApp = Nothing Load CloseCheck CloseCheck.Show End Sub




Reply With Quote