ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   emailing workbooks (https://www.excelbanter.com/excel-programming/290926-emailing-workbooks.html)

William Barnes

emailing workbooks
 
Using Excel 2000 under Win 2K:

I'd like to write code that will send a workbook as an attachment by email.
I haven't been able to find much in the help files. I tried the following
but got a 1004 Run-Time Error 'Application-Defined or Object-Defined Error'

"MyUserName" is the UserID required to log in to my Email server,
"MyPassword" is the password for the same.

Public Sub MailWkbk()
If IsNull(Application.MailSession) Then
Application.MailLogon "MyUserName", "MyPassword", False
End If

ThisWorkbook.SendMail "MyEmailAddress", "Test Send"

Application.MailLogoff

End Sub

Can anyone suggest some code to accomplish this?



Frank Kabel

emailing workbooks
 
Hi
you may have a look at
http://www.rondebruin.nl/sendmail.htm
for more information regarding mailing from Excel

Frank


WIlliam Barnes wrote:
Using Excel 2000 under Win 2K:

I'd like to write code that will send a workbook as an attachment by
email. I haven't been able to find much in the help files. I tried
the following but got a 1004 Run-Time Error 'Application-Defined or
Object-Defined Error'

"MyUserName" is the UserID required to log in to my Email server,
"MyPassword" is the password for the same.

Public Sub MailWkbk()
If IsNull(Application.MailSession) Then
Application.MailLogon "MyUserName", "MyPassword", False
End If

ThisWorkbook.SendMail "MyEmailAddress", "Test Send"

Application.MailLogoff

End Sub

Can anyone suggest some code to accomplish this?





All times are GMT +1. The time now is 03:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com