Guys,
I have pieced together a code using DeBruin's to send emails through Gmail.
I cannot for the life of me add the active workbook as an attachment.
As it currently runs, it attaches a blank attachment.
I have been working on this for hours, but cant get it worked out.
Appreciate any help.
Sub btnEmailBid_Click()
Dim Mail As New Message
Dim Config As Configuration
Set Config = Mail.Configuration
Config(cdoSendUsingMethod) = cdoSendUsingPort
Config(cdoSMTPServer) = "smtp.gmail.com"
Config(cdoSMTPServerPort) = 25
Config(cdoSMTPAuthenticate) = cdoBasic
Config(cdoSMTPUseSSL) = True
Config(cdoSendUserName) = "xxx@abc.com"
Config(cdoSendPassword) = "xxxx"
Config.Fields.Update
Mail.To = "xxx@abc.com"
Mail.From = Config(cdoSendUserName)
Mail.Subject = "New Bid - " & Range("f5").Value & " " & Range("f6")
Mail.TextBody = "Attached are copies of the bid and pics." & " " & vbNewLine & _
"Let me know if you have any questions." & vbNewLine & vbNewLine & _
"Thanks,"
Mail.AddAttachment ""
On Error Resume Next
Mail.Send
If Err.Number <> 0 Then
MsgBox Err.Description, vbCritical, "There was an error."
Exit Sub
End If
I have pieced together a code using DeBruin's to send emails through Gmail.
I cannot for the life of me add the active workbook as an attachment.
As it currently runs, it attaches a blank attachment.
I have been working on this for hours, but cant get it worked out.
Appreciate any help.
Sub btnEmailBid_Click()
Dim Mail As New Message
Dim Config As Configuration
Set Config = Mail.Configuration
Config(cdoSendUsingMethod) = cdoSendUsingPort
Config(cdoSMTPServer) = "smtp.gmail.com"
Config(cdoSMTPServerPort) = 25
Config(cdoSMTPAuthenticate) = cdoBasic
Config(cdoSMTPUseSSL) = True
Config(cdoSendUserName) = "xxx@abc.com"
Config(cdoSendPassword) = "xxxx"
Config.Fields.Update
Mail.To = "xxx@abc.com"
Mail.From = Config(cdoSendUserName)
Mail.Subject = "New Bid - " & Range("f5").Value & " " & Range("f6")
Mail.TextBody = "Attached are copies of the bid and pics." & " " & vbNewLine & _
"Let me know if you have any questions." & vbNewLine & vbNewLine & _
"Thanks,"
Mail.AddAttachment ""
On Error Resume Next
Mail.Send
If Err.Number <> 0 Then
MsgBox Err.Description, vbCritical, "There was an error."
Exit Sub
End If