I upgraded to Excel 2010 last week and when I went to use this Macro, it no longer worked. I just used in in 2007 and nothing has changed at all besides the upgrade. The line with the error is red below. Help!
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
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