Results 1 to 7 of 7

Thread: [Resolved] Email address chokes Outlook.

Threaded View

  1. #1

    Thread Starter
    Fanatic Member Comintern's Avatar
    Join Date
    Nov 2004
    Location
    Lincoln, NE
    Posts
    826

    Resolved [Resolved] Email address chokes Outlook.

    OK, I have a macro that generates worksheets to send to another department. That department added a new member who's email address managed to break my mail routine, and I can't figure out why. I use the internal network email addressing ("Lastname, Firstname") because it's a lot easier than remembering who all the addresses belong to (our address system is kind of cryptic). Here's the code I use:

    VB Code:
    1. If Len(frmOutputOpts.cmbEmailTo.Text) > 0 Then   'ComboBox with email addresses.
    2.     Set oOutlook = New Outlook.Application
    3.     Set oEmail = oOutlook.CreateItem(olMailItem)
    4.     With oEmail
    5.         If frmOutputOpts.cbxCC.Value = True Then
    6.             Set oRecip = .Recipients.Add("Xxxxxxxxx, Xxxxx")   'Real name removed.
    7.             oRecip.Type = olCC
    8.         End If
    9.         .Recipients.Add (frmOutputOpts.cmbEmailTo.Text)
    10.         .Subject = frmDeathClaim.txtLastName.Text + ", " + frmDeathClaim.txtPolicyNum.Text
    11.         Call .Attachments.Add(sSaveAs, olByValue, 1, oEmail.Subject + ".doc")
    12.         .Send
    13.     End With
    14.     Set oRecip = Nothing
    15.     Set oEmail = Nothing
    16.     Set oOutlook = Nothing
    17. End If
    It gives Error number -1179631611, Outlook does not recognize one or more names, on the .Send line. Strange thing is, I can copy and paste the email address from my ComboBox into Outlook manually, and it works fine from there. Just not through code. The new email address is:

    Xxxxxxx, Xxxxx (Life Annuity Claims)

    I'm guessing it has something to do with the ()'s. I can do a workaround and use the [email protected] format, but I don't want to hard-code addresses into the macro.

    Any ideas?
    Last edited by Comintern; Mar 24th, 2005 at 05:43 PM. Reason: Problem resolved, thanks!

Posting Permissions

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



Click Here to Expand Forum to Full Width