Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Dynamic Filenames with Application.Run

I have an Excel file containing multiple worksheets and multiple
macros.

For reporting purposes, the Excel filename contains a date (for
example, "Measures - 10-05-05 v1.xls"

One of the macros calls another macro within the file. The way the
file is setup, I need to keep the macros on seperate worksheets.

The problem I have is that I must edit the macro every time I rename /
resave the file. Anytime the file is saved with the new date, the macro
doesn't work since the filename is included (ie. Application.Run
"'Measures - 10-05-05 v1.xls'!Macro_1")

Is there a way to use a dynamic filename in the Application.Run
statement such that I don't have to change the macro everytime I rename
the file?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Dynamic Filenames with Application.Run

to call a macro within the same workbook you should only have to do

Macro1

to run/call it

You should have no need to use Run or the workbook name.

However, you can get the workbook name with

ThisWorkbook.Name

--
Regards,
Tom Ogilvy

wrote in message
oups.com...
I have an Excel file containing multiple worksheets and multiple
macros.

For reporting purposes, the Excel filename contains a date (for
example, "Measures - 10-05-05 v1.xls"

One of the macros calls another macro within the file. The way the
file is setup, I need to keep the macros on seperate worksheets.

The problem I have is that I must edit the macro every time I rename /
resave the file. Anytime the file is saved with the new date, the macro
doesn't work since the filename is included (ie. Application.Run
"'Measures - 10-05-05 v1.xls'!Macro_1")

Is there a way to use a dynamic filename in the Application.Run
statement such that I don't have to change the macro everytime I rename
the file?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro for creating dynamic filenames Brian Beck Excel Discussion (Misc queries) 6 July 27th 06 08:24 PM
Help with filenames and paths. jim9912 Excel Discussion (Misc queries) 2 March 30th 06 05:52 PM
Getting filenames via VBA Andrew Excel Programming 5 April 15th 05 12:41 PM
Getting a list of filenames Bernie Deitrick Excel Programming 0 April 13th 05 02:55 PM
Using Variables in filenames Blinky Bill Excel Discussion (Misc queries) 2 March 11th 05 12:07 AM


All times are GMT +1. The time now is 11:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"