Re: Mail Merging For Invoices
there is a way you can do it using a microsoft reference method
'Need Reference - Microsoft CDO for NTS 1.xx Library
Sub SendMail(strTo, strFrom, strSubject, strCopy)
Const cdoSendUsingPort = 25
Const cdoBasic = 1
Dim objCDOConfig As Object, objCDOMessage As Object
Dim strSch As String, strAttach As String
Dim objAttach As Object, objAttachColl As Object
strSch = "http://schemas.microsoft.com/cdo/configuration/"
Set objCDOConfig = CreateObject("CDO.Configuration")
With objCDOConfig.Fields
.Item(strSch & "sendusing") = cdoSendUsingPort
.Item(strSch & "smtpserver") = "132.147.160.34"
'Only used if SMTP server requires Authentication
'.Item(strSch & "SMTPAuthenticate") = cdoBasic
'.Item(strSch & "SendUserName") = "[email protected]"
'.Item(strSch & "SendPassword") = "PasswordToGoHere"
'.Update
End With
Set objCDOMessage = CreateObject("CDO.Message")
' Set objAttach = objCDOMessage.Attachments.Add
'Set objAttach = objAttachColl.Add '("test", 0, CdoFileData, "\\NTCH05" & Format$(Date, "ddmmmyy") & ".pdf") ' add an attachment
With objCDOMessage
Set .Configuration = objCDOConfig
.From = Trim(strFrom)
.Sender = Trim(strFrom)
.To = Trim(strTo)
.Subject = Trim(strSubject)
.TextBody = Trim(strCopy)
'.HTMLBody = Trim(strCopy)
.Send
End With
Set objCDOMessage = Nothing
Set objCDOConfig = Nothing
End Sub
Display More
then you build your mail by stringing together all your cells in a different sub
Call SendMail("<<SEND TO>>", "<<SEND FROM>>", "<<SUBJECT LINE>>", <<message>>)
it's a long winded way of doing it but it works fine...