Exporting date in filename Access macro

JKWyo

New Member
Joined
Sep 4, 2014
Messages
20
I have an access database that I want to export out to excel workbook with the date as part of the file name. Googled and searched for several hours and of the suggestions I see, I can't get any of them to work. Keep getting the Access can't save the output data to the file you've selected error, but none of the reasons are valid.

Here are the output file paths and date part combination that seems to be the most recommended on the web:

C:\Fixed Assets\2013 Spreadsheets\CAPSAO & Format(Date(),"yyyymmdd") & .xlsx

I've tried many variants of the above line with no luck, but if I take out the " " in the command, the file saves as "CAPSAO & Format(Date(), yyyymmdd) &"

C:\Fixed Assets\2013 Spreadsheets \CAPSAO & (Date(), yyyymmdd) & .xlsx

Any other suggestions?

Thanks for your time.
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
You would need to do this in VBA (cannot do it directly in a Macro - you cannot have variables in a Macro).

You would build your filename variable like this:
Code:
[COLOR=#333333]myFileName = "C:\Fixed Assets\2013 Spreadsheets\CAPSAO "& Format(Date(),"yyyymmdd") & ".xlsx"[/COLOR]

Note you can convert your Macros to VBA pretty easily using the "Convert Macros to Visual Basic" button on the Macro Toolbar.
 
Upvote 0

Forum statistics

Threads
1,221,848
Messages
6,162,415
Members
451,762
Latest member
Brainsanquine

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