简体   繁体   中英

Downloading excel file name based on date Macro

I'm trying to write a macro that downloads data into a file, where the file name contains yesterdays date.

"TEXT; http://www.mydomainname.co.uk/price_spiders_competitors_prices_gb/GBPS AEG " & Format(Today() - 1, "yyyy-mm-dd") & " higher_than.csv" _ , Destination:=Range("$A$1"))

This isn't working

"TEXT; http://www.mydomainname.co.uk/price_spiders_competitors_prices_gb/GBPS AEG 2013-02-06 higher_than.csv" _ , Destination:=Range("$A$1"))

This does!

Any ideas, I have a feeling the dashes are causing an issue but it also doesn't seem to like my Today -1!

Thanks for any help

Try function 'Now()' instead of 'Today()' to get the current date and time.

As far as i know, excel doesn't have the function 'today()' in VBA. You can use 'today()' in a formula but not in VBA.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM