I have a Macro that I created to run a query and produce a file daily. I want to name the file YYYYMMDD, but I can't figure how how to dynamically change the file name. Ideas?
Convert the macro to Visual Basic. Go to Modules, find that macro converted, open the module. In the sub created, somewhere you 'll find the name of file saved in a path.
Change it to "c:\path\filename" & format(Date, "yyyymmdd") & ".xls" or something to your needs.
At the top, change the Sub word to Function. Create a new macro that runs the function and substitute the old macro name you had with this new one!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.