Good morning Access Guru's -
It's been a very long time since I've posted, because all of your previous assistance has worked out so well. I've been able to tweak what you shared to grow my DB. However, I now find myself in quite the conundrum....my company as switched from previous Gmail platform to Office 365.
I googled and found VBA code to convert modules to send e-mail from Access 2010 using O365. However, I am constantly receiving the following Run-time Error:
"Run-time error '-2147220973 (80040213'):
The transport failed to connect to the server."
Attached is the code I'm attempting to use.
[Public Sub BDP_Import_SKU_List_Full_Upld2()
Set cdoMsg = CreateObject("CDO.message")
With cdoMsg.Configuration.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthentication") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.office365.com"
'.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 587
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 180
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "My-email"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "My-Password"
.Update
End With
With cdoMsg
DoCmd.Close acReport, "close active report"
DoCmd.OpenQuery "update date query", acVierNormal 'track date of last action
DoCmd.OpenReport "re-open active report" 'after date refresh
DoCmd.Maximize
End With
With cdoMsg
.To = "email recipients"
.CC = "copy recipients"
.From = "my-email"
.Subject = "DBP - " & _
"" & _
"" & _
"Thank you," & _
"" & _
"" & _
"Salutation"
.AddAttachment ("Z:File Path\filemname.xlsx")
.Send
End With
End Sub
Public Static Function public_Function_name()
Call public_sub_name
End Function]
Please review and advise what/how I can make this work. Please note, I'm still extremely green when it comes to writing code. Everything here I have garnered from your previous inputs, and web-searches.
As always, thank you very much for your time. I truly appreciate all of the help you have provided in the past.
Bryon