Ik wil gebruik maken met onderstaande macro van ron de Bruim voor het verzenden van een Excel bestand via VBA
Ik blijf echter maar tegen het feit aanlopen dat de macro blijft steken op .send
heb het ook vanaf een andere locatie geprobeerd en ook met andere varianten (al dan niet van Ron)
Wat kan er fout gaan?
Ik blijf echter maar tegen het feit aanlopen dat de macro blijft steken op .send
heb het ook vanaf een andere locatie geprobeerd en ook met andere varianten (al dan niet van Ron)
Wat kan er fout gaan?
Code:
Sub CDO_Mail_Small_Text_2()
Dim iMsg As Object
Dim iConf As Object
Dim strbody As String
Dim Flds As Variant
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
iConf.Load -1 ' CDO Source Defaults
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "xxxxxx@gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "xxxxxx"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
.Update
End With
strbody = "Hi there" & vbNewLine & vbNewLine & _
"This is line 1" & vbNewLine & _
"This is line 2" & vbNewLine & _
"This is line 3" & vbNewLine & _
"This is line 4"
With iMsg
Set .Configuration = iConf
.To = "xxxxxx@gmail.com"
.CC = ""
.BCC = ""
' Note: The reply address is not working if you use this Gmail example
' It will use your Gmail address automatic. But you can add this line
' to change the reply address .ReplyTo = "Reply@something.nl"
.From = """reply"" <Reply@something.nl>"
.Subject = "Test"
.TextBody = strbody
.Send
End With
End Sub