ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Attaching Files to Emails (https://www.excelbanter.com/excel-programming/317178-attaching-files-emails.html)

Ben

Attaching Files to Emails
 
How can I get the following code to instead of attaching a file that I
specify in code to the email. I would like to make it open a browse screen so
that they can browse to a file for me at attach to the email.

With MailObject
.To = "EmailAddress"
.Subject = strFileName & " - " & Me.txtDescription
.Attachments.Add "c:\My Documents\book.doc"
.Display
End With

Thank you in advance.

James W.

Attaching Files to Emails
 
Try

fName = Application.GetOpenFileName()




"Ben" wrote:

How can I get the following code to instead of attaching a file that I
specify in code to the email. I would like to make it open a browse screen so
that they can browse to a file for me at attach to the email.

With MailObject
.To = "EmailAddress"
.Subject = strFileName & " - " & Me.txtDescription
.Attachments.Add "c:\My Documents\book.doc"
.Display
End With

Thank you in advance.



All times are GMT +1. The time now is 02:07 PM.

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