ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   rename file macro (https://www.excelbanter.com/excel-programming/284514-rename-file-macro.html)

dtroupe

rename file macro
 
I am exporting from Access to Excel by using a macro in
Access. Access overwrites the file unless you change the
name of the worksheet the export created in which case it
will create a second worksheet. I can either keep renaming
the worksheet after it is created, (which needs to be
automated without opening the worksheet manually), or I
can just run some kind of auto macro that will look for a
sheet named export.xls at some time in the morning after
the other macro has created the file and name it to the
machine date, i.e. 12032003.xls ? If I can do the later
then I can force the macro in Access to run at 00:10 in
the morning by a Windows Scheduler I am using and then
have that scheduler open this Excel file and close it
after renaming the export.xls file (if it exists). This
way I can enjoy my weekends?

Tom Ogilvy

rename file macro
 
You can't rename it using the macro in Access?

Look at the VBA Name function .

Name "c:\abcd\export.xls" as "c:\abcd\" & format(date,"yyyymmdd") & ".xls"
--
Regards,
Tom Ogilvy

dtroupe wrote in message
...
I am exporting from Access to Excel by using a macro in
Access. Access overwrites the file unless you change the
name of the worksheet the export created in which case it
will create a second worksheet. I can either keep renaming
the worksheet after it is created, (which needs to be
automated without opening the worksheet manually), or I
can just run some kind of auto macro that will look for a
sheet named export.xls at some time in the morning after
the other macro has created the file and name it to the
machine date, i.e. 12032003.xls ? If I can do the later
then I can force the macro in Access to run at 00:10 in
the morning by a Windows Scheduler I am using and then
have that scheduler open this Excel file and close it
after renaming the export.xls file (if it exists). This
way I can enjoy my weekends?





All times are GMT +1. The time now is 08:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com