Email Attachments

KirovHC

New Member
Joined
Jan 19, 2021
Messages
32
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I created a sheet that basically serves to send emails automatically.
My problem arises when I have to attach files: I currently use the string .attachments.Add "filepath".
This assumes that the user puts the file to attach in the given path.
I would like to let the user choose the path of the file to attach, do you have any suggestions about it?
Greetings to all,
Kirov.
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Hello,
could you kindly give me an example by inserting a simple button? (click, select the file)
I have to go offline right now. Suggest you look at the link I posted and google Excel VBA GetOpenFilename for examples of use.
 
Upvote 0
Here's code I've been using. You can select single/multiple.

Code:
AttachFileName = Application.GetOpenFilename("Files (*.**)," & _
"*.**", 1, "Select File", "Open", True)
For i = 1 To UBound(AttachFileName)

.Attachments.Add AttachFileName(i)
 
Upvote 0

Forum statistics

Threads
1,215,641
Messages
6,125,981
Members
449,276
Latest member
surendra75

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top