Problem sending mail via excel

J

Jas

Hi, I have the following code:

With Application.Dialogs(xlDialogSendMail)
.Show
.To = "[email protected]"
.Subject = "New Set-Up required"
.Body = "Please attach additional documents if appropriate and send the
email as normal."
.Attachments.Add ActiveWorkbook.FullName
End With

But the To, Subject and Body fields do not populate with the fields that I
have specified. I am very new to this so any suggestions would help hugely!!

Many thanks
Jas
 
M

Michael Bednarek

Hi, I have the following code:

With Application.Dialogs(xlDialogSendMail)
.Show
.To = "[email protected]"
.Subject = "New Set-Up required"
.Body = "Please attach additional documents if appropriate and send the
email as normal."
.Attachments.Add ActiveWorkbook.FullName
End With

But the To, Subject and Body fields do not populate with the fields that I
have specified. I am very new to this so any suggestions would help hugely!!

You forgot to mention that your code also produces four run-time error
messages because the Dialog object doesn't support any of the
methods/properties after .Show .

You can either use the SendMail method, or if you want more control over
the process and are in a position to utilise Outlook, use that program's
COM interface.
 
S

Sue Mosher [MVP-Outlook]

You might want to post in an Excel group, since they'll be more familiar with coding the dialogs you're referring to.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Top