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

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
That code looks fine to me, the only thing missing is Loop.

Is it not working as expected?
 
Upvote 0

Forum statistics

Threads
1,223,234
Messages
6,170,891
Members
452,366
Latest member
TePunaBloke

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