Hi, Friends good morning....
I have developed a macro sheet to send emails through lotus notes, which is working good, but i want to attach some pdf files as attachment, which i am unable to attach.
Seeking your help to attach pdf file in below coding.
Below is my coding..(Now i just want to attach pdf file saved at my desktop at the end of email body)
Function ExceltoLotus1()
Dim Email As String, Subj As String, Msg As String
Dim r As Integer, x As Double
Dim Maildb As Object, UserName As String, MailDbName As String, DomDbName As String
Dim stFileName As String
Dim MailDoc As Object, Session As Object
Set Session = CreateObject("Notes.NotesSession")
UserName = Session.UserName
MailDbName = "mail" & Mid$(UserName, 4, InStr(1, UserName, " ") - 4) & Mid$(UserName, _
InStr(1, UserName, " ") + 1, InStr(1, UserName, "/") - InStr(1, UserName, " ") - 1) & ".nsf"
Set Maildb = Session.GetDatabase("", MailDbName)
If Maildb.IsOpen = True Then
Else: Maildb.OPENMAIL
End If
For r = 2 To Range("a1").End(xlDown).Row
Set MailDoc = Maildb.CreateDocument
MailDoc.Form = "Memo"
Email = Cells(r, 3)
Subj = "Attention required-Settlement of Travel Advance"
Msg = Msg & Range("K" & r) & "" & vbCrLf & vbCrLf
Msg = Msg & Range("L" & r) & "" & vbCrLf & vbCrLf
Msg = Msg & "" & vbCrLf & vbCrLf
Msg = Msg & "Thanks & Regards," & vbCrLf
Msg = Msg & "abc team" & vbCrLf
Msg = Msg & "abc Office"
MailDoc.Principal = "******@abc.com"
MailDoc.sendto = Email
'MailDoc.CopyTo = Whomever
'MailDoc.BlindCopyTo = Whomever
MailDoc.Subject = Subj
MailDoc.Body = Msg
MailDoc.SaveMessageOnSend = True
MailDoc.PostedDate = Now
'Wait two seconds before sending keystrokes
'Application.Wait (Now + TimeValue("0:00:02"))
'Application.SendKeys "%s"
On Error GoTo Audi
Call MailDoc.Send(False)
Next r
Set Maildb = Nothing: Set MailDoc = Nothing: Set Session = Nothing
Exit Function
Audi:
Set Maildb = Nothing: Set MailDoc = Nothing: Set Session = Nothing
End Function