excel vba send mail attached dynamic filename by date format

toothboy

New Member
Joined
May 31, 2016
Messages
1
Hi all, I am new in VBA, I am trying to attached those files in a folder which their filename start with date format (eg : yyyymmdd_filename1.pdf, yyyymmdd_filename2...etc ), is it possible to attached the file with correct date? says when I run the marco today, it will attached the filename start with "20160601".

here is my code :

AttFile = Dir(fldPath & "20160601*.pdf")
Do While Len(AttFile) > 0
.Attachments.Add fldPath & AttFile
AttFile = Dir
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
That code looks fine to me, the only thing missing is Loop.

Is it not working as expected?
 
Upvote 0

Forum statistics

Threads
1,215,059
Messages
6,122,918
Members
449,093
Latest member
dbomb1414

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