Newbie alert!
I have read the forum, found and modified code to use Excel to send an email via Lotus Notes. I have the email working and really enjoy the power of VB. I see a class in the near future.
I have a spreadsheet with Comany Name in column A and email address in column B. How do I get it to auto populate the Company name into the subject line and attach a unique attachment(with same company name) to each email? I also found the spoofing code for reply to address but need to know where to insert it.
Any help is appreciated.
The code I have thus far is:
Sub email()
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o> </o>
Dim Maildb As Object, UserName As String, MailDbName As String
Dim MailDoc As Object, Session As Object
Dim cl As Range
Set Session = CreateObject("Notes.NotesSession")
UserName = Session.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, _
(Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
Set Maildb = Session.GetDatabase("", MailDbName)
If Not Maildb.IsOpen Then Maildb.OpenMail
For Each cl In Range([b2], [b65536].End(3))
Set MailDoc = Maildb.CreateDocument
MailDoc.Form = "Memo"
MailDoc.SendTo = Right$(cl, Len(cl) - 1) 'Nickname or full address
'MailDoc.CopyTo = Whomever
MailDoc.BlindCopyTo = "blind@mydomain.com"
MailDoc.Subject = "COMPANY NAME &SUBJECT TEXT"
MailDoc.Body = _
Replace("Hello, @@" & _
"BODY TEXT " & _
cl(, 2) & _ 'what does this designate?
" BODY TEXT " & _
"@@Your response to this request in the next 5 business days is highly appreciated." & _
"@@Regards," & _
"@@William Moore" & _ , "@", vbCrLf)
<o> </o>
MailDoc.SaveMessageOnSend = True
MailDoc.PostedDate = Now
On Error GoTo Audi
Call MailDoc.Send(False)
Audi: On Error GoTo 0
Next
<o> </o>
Set Maildb = Nothing: Set MailDoc = Nothing: Set Session = Nothing
End Sub
I have read the forum, found and modified code to use Excel to send an email via Lotus Notes. I have the email working and really enjoy the power of VB. I see a class in the near future.
I have a spreadsheet with Comany Name in column A and email address in column B. How do I get it to auto populate the Company name into the subject line and attach a unique attachment(with same company name) to each email? I also found the spoofing code for reply to address but need to know where to insert it.
Any help is appreciated.
The code I have thus far is:
Sub email()
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o> </o>
Dim Maildb As Object, UserName As String, MailDbName As String
Dim MailDoc As Object, Session As Object
Dim cl As Range
Set Session = CreateObject("Notes.NotesSession")
UserName = Session.UserName
MailDbName = Left$(UserName, 1) & Right$(UserName, _
(Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
Set Maildb = Session.GetDatabase("", MailDbName)
If Not Maildb.IsOpen Then Maildb.OpenMail
For Each cl In Range([b2], [b65536].End(3))
Set MailDoc = Maildb.CreateDocument
MailDoc.Form = "Memo"
MailDoc.SendTo = Right$(cl, Len(cl) - 1) 'Nickname or full address
'MailDoc.CopyTo = Whomever
MailDoc.BlindCopyTo = "blind@mydomain.com"
MailDoc.Subject = "COMPANY NAME &SUBJECT TEXT"
MailDoc.Body = _
Replace("Hello, @@" & _
"BODY TEXT " & _
cl(, 2) & _ 'what does this designate?
" BODY TEXT " & _
"@@Your response to this request in the next 5 business days is highly appreciated." & _
"@@Regards," & _
"@@William Moore" & _ , "@", vbCrLf)
<o> </o>
MailDoc.SaveMessageOnSend = True
MailDoc.PostedDate = Now
On Error GoTo Audi
Call MailDoc.Send(False)
Audi: On Error GoTo 0
Next
<o> </o>
Set Maildb = Nothing: Set MailDoc = Nothing: Set Session = Nothing
End Sub