Hi
I have the a problem for which i need some help.
Sub Send_mail()
' This code goes threw mail adresses in column B and sends a HTML template as body text to them.
Dim iMsg As Object
Dim iConf As Object
Dim strbody As String
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
iConf.Load -1
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") _
= "My smtp mail server"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Update
End With
Range("B1").Select
Do Until IsEmpty(ActiveCell)
With iMsg
Set .Configuration = iConf
.To = ActiveCell.Text
.CC = ""
.BCC = ""
.From = """Me"" <my@email.com>"
.Subject = "Type subject here"
.CreateMHTMLBody "file://C:/My template file path"
.Send
End With
ActiveCell.Offset(1, 0).Select
Loop
End Sub
What i need is something in the code that replaces a variable in the HTML Template [FirstName] with the Name in column A.
Any help is welcome
Steffen Thomsen
Bookmarks