ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   This File Name (https://www.excelbanter.com/excel-programming/308934-file-name.html)

theillknight

This File Name
 
Hi,

Is there a way to create a dynamic filename?

For instance, if I want to create a macro that did:

Windows("THISFILENAME").Activate

but I saved the file under a different name, I would have to edit the
macro or I would get a subscript out of range error. Any help would be
greatly appreciated.

Thanks.


---
Message posted from http://www.ExcelForum.com/


Chip Pearson

This File Name
 
Try

Windows(ThisWorkbook.Name).Activate
' or
ThisWorkbook.Activate

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"theillknight "
wrote in message
...
Hi,

Is there a way to create a dynamic filename?

For instance, if I want to create a macro that did:

Windows("THISFILENAME").Activate

but I saved the file under a different name, I would have to
edit the
macro or I would get a subscript out of range error. Any help
would be
greatly appreciated.

Thanks.


---
Message posted from http://www.ExcelForum.com/




Tom Ogilvy

This File Name
 
Phatchef24 is that you?

--
Regards,
Tom Ogilvy

"theillknight " wrote in
message ...
Hi,

Is there a way to create a dynamic filename?

For instance, if I want to create a macro that did:

Windows("THISFILENAME").Activate

but I saved the file under a different name, I would have to edit the
macro or I would get a subscript out of range error. Any help would be
greatly appreciated.

Thanks.


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 01:37 AM.

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