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

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
That code looks fine to me, the only thing missing is Loop.

Is it not working as expected?
 
Upvote 0

Forum statistics

Threads
1,214,996
Messages
6,122,636
Members
449,092
Latest member
bsb1122

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