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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel sendmail

Status
Not open for further replies.

longhair

MIS
Feb 7, 2001
889
US
I have a small vba procedure that imports data from a text file and then mails the excel woorkbook using the ActiveWorkbook.SendMail Recipients:="" command. This works fine when MS Outlook is open. If Outlook is closed (which it will be when I'm not in th office), excel pops up a message box asking me to choose a profile. If I hit OK the email goes on its merry way.
So the question is, does anyone know how to programatically set the profile so the message box does not appear & the email mails?
TIA
longhair
 
bearnone,
Actually don't have access to more than one profile. But the fix was as follows:
If IsNull(Application.MailSession) Then
Application.MailLogon "MS Exchange Settings", , False
End If
and then the following at the end to logoff:
If Not IsNull(Application.MailSession) Then
Application.MailLogoff
End If
VBA did not pickup the defaults.
Thanks for the link to MS KB it was interesting.

regards,

longhair
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top