|
-
Mar 24th, 2005, 02:34 PM
#1
Thread Starter
Fanatic Member
[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:
If Len(frmOutputOpts.cmbEmailTo.Text) > 0 Then 'ComboBox with email addresses.
Set oOutlook = New Outlook.Application
Set oEmail = oOutlook.CreateItem(olMailItem)
With oEmail
If frmOutputOpts.cbxCC.Value = True Then
Set oRecip = .Recipients.Add("Xxxxxxxxx, Xxxxx") 'Real name removed.
oRecip.Type = olCC
End If
.Recipients.Add (frmOutputOpts.cmbEmailTo.Text)
.Subject = frmDeathClaim.txtLastName.Text + ", " + frmDeathClaim.txtPolicyNum.Text
Call .Attachments.Add(sSaveAs, olByValue, 1, oEmail.Subject + ".doc")
.Send
End With
Set oRecip = Nothing
Set oEmail = Nothing
Set oOutlook = Nothing
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|