Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic Values in Report Names

Status
Not open for further replies.

wazup3d

MIS
Jul 24, 2009
2
US
Hello! I have a table that I'm trying to export to another directory and when I do the export I'd like to save the file in the new location with a dynamic file name based on the date. For example... test_072409.xls. How in the world would I get access to output the file that was originally called test.xls as test_mmddyy.xls so that every day when I run the macro it automatically follows that naming convention? I appreciate any help! Thanks!
 


Hi,
Code:
dim sFileName as string
sfilename = "test_" & format(Date, "mmddyy") & ".xls"


Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Thanks Skip! Forgive my ignorance... I don't usually get this fancy but I assume the code should be saved as a module? If so, how do I then call that module? Thanks for your help!
 

Yes, the code is stored in a module as a procedure (sub or function). You would call the sub or function from an event, like a button click.

Of course, this code is just a fragment of what you would need to save your report as an Excel workbook.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top