Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Email Macro Trimming Address

Status
Not open for further replies.

JohnOB

Technical User
Oct 5, 2006
253
GB
Hi, I am using the below email macro in Excel assigned to a form button, so the user hits the button and the spreadsheet is attached to an email with a specific address in the to field.

The macro I am using is (i got it from
Code:
Sub Mail_workbook_1()
'Working in 97-2007
    Dim wb As Workbook
    Set wb = ActiveWorkbook
 
    If Val(Application.Version) >= 12 Then
        If wb.FileFormat = 51 And wb.HasVBProject = True Then
            MsgBox "There is VBA code in this xlsx file, there will be no VBA code in the file you send." & vbNewLine & _
                   "Save the file first as xlsm and then try the macro again.", vbInformation
            Exit Sub
        End If
    End If
 
    On Error Resume Next
    wb.SendMail "jbloggs@our-work.co.uk", _
                "ARMS Report Request"
    On Error GoTo 0
End Sub

The problem is that in the email that comes up, the "To" field is cutting off the ".uk" so all it says is "jbloggs@our-work.co". When I enter text in here without the dot it doesn't cut if off so it doesn't seem to be the number of characters, I am thinking perhaps it is formatted somehow to only accept email address from a certain country, whose domains end in only two letters, but not sure how to change this.

Thanks

John

"Stupid isn't not knowing the answer, it's not asking the question
 
What happens when you comment out this line ?
On Error Resume Next

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hi, this problem has suddenly resolved itself, now it is diaplaying the full address, maybe it was just one of those Friday things.

Thanks anyway

"Stupid isn't not knowing the answer, it's not asking the question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top