
Originally Posted by
royUK
Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found
here
Take the time to actually read the Forum Rules that you have agreed to. Then add the tags & amend the post title.
Does this do it?
Sub EmailNotes()
Dim objNotesSession As Object
Dim objNotesDb As Object
Dim objNotesDoc As Object
Dim vaRecipients As String
Dim r As Long
Dim Msg As String
On Error GoTo Error_Handling
Application.ScreenUpdating = False
Set session = CreateObject("Notes.NotesSession")
strServer = session.GetEnvironmentString("MailServer", True)
strMailfile = session.GetEnvironmentString("MailFile", True)
Set db = session.GETDATABASE(strServer, strMailfile)' Set uiws = CreateObject("Notes.NotesUIWorkspace")
'
' If db.IsOpen = True Then
' 'Already open for mail
' Else
' db.OpenMail
' End If
For r = 9 To Range("BA65536").End(xlUp).Row
'Create the e-mail and add the attachment.
' Set objNotesDoc = objNotesDb.CREATEDOCUMENT
Msg = ""
Msg = Msg & Range("BF" & r) & "," & vbCrLf & vbCrLf
Msg = Msg & Range("BD" & r) & "." & vbCrLf & vbCrLf
Msg = Msg & "Thank you," & vbCrLf
Msg = Msg & "John Doe"
vaRecipients = Range("BA" & r)
CreateAndDisplayNotesEmail vaRecipients, Range("BE" & r) & " Timecard ", Msg, ""
'increment for the next person
r = r + 23
Next
MsgBox ("The e-mails have successfully been distributed."), vbInformation
ExitSub:
'Release objects from memory.
Set db = Nothing
Set session = Nothing
Set uiws = Nothing
Exit Sub
Error_Handling:
MsgBox "Error number: " & Err.Number & vbNewLine & _
"Description: " & Err.Description, vbOKOnly
Resume ExitSub
End Sub
Bookmarks