+ Reply to Thread
Results 1 to 3 of 3

Macro not working in Excel 2010. HELP!!!

  1. #1
    Registered User
    Join Date
    04-21-2011
    Location
    florida
    MS-Off Ver
    Excel 2010
    Posts
    6

    Macro not working in Excel 2010. HELP!!!

    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.

    This macro is to generate a string of emails in Lotus Notes without sending them. There is some verbiage that is automatically included in the email (some in the macro and some in a cell with a formula...

    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

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Macro not working in Excel 2010. HELP!!!

    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.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Registered User
    Join Date
    04-21-2011
    Location
    florida
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Macro not working in Excel 2010. HELP!!!

    Quote Originally Posted by royUK View Post
    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?

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1