ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Current File (https://www.excelbanter.com/excel-programming/352822-current-file.html)

Jim Berglund[_2_]

Current File
 
I have a pricing spreadsheet which I typically modify and save for each
prospect under the account name. As such, I have t go into the code and
replace all the current filename references.

There must be a better way to do this...

Any ideas, please?

Thanks much,
Jim Berglund



David

Current File
 
Make the active.name a variable and use that in your code.
--
David


"Jim Berglund" wrote:

I have a pricing spreadsheet which I typically modify and save for each
prospect under the account name. As such, I have t go into the code and
replace all the current filename references.

There must be a better way to do this...

Any ideas, please?

Thanks much,
Jim Berglund




ben

Current File
 
I'm sure he meant to tell you to use the refence as

Activeworkbook.Name
as a varialbe rather than
Workbooks("MyWorkbook.xls")
reference
also you could refer to the workbook as

ThisWorkbook.Worksheets(1).Range("A1")
or
ActiveWorkbook.Worksheets(1).Range("A1")



--
When you lose your mind, you free your life.


"David" wrote:

Make the active.name a variable and use that in your code.
--
David


"Jim Berglund" wrote:

I have a pricing spreadsheet which I typically modify and save for each
prospect under the account name. As such, I have t go into the code and
replace all the current filename references.

There must be a better way to do this...

Any ideas, please?

Thanks much,
Jim Berglund




Jim Thomlinson[_5_]

Current File
 
A little difficult to comment on without seeing some code. That being said...

Thisworkbook. 'Always refers to the bookk that is executing the code
Activeworkbook. 'refers to whichever book happens to be active at the time

You can also use workbook objects kind of like this

dim wbk as workbook

set wbk = activeworkbook
'Now you can always make reference to the workbook that was acive when this
line of code was run, even if you activate a different workbook...

--
HTH...

Jim Thomlinson


"Jim Berglund" wrote:

I have a pricing spreadsheet which I typically modify and save for each
prospect under the account name. As such, I have t go into the code and
replace all the current filename references.

There must be a better way to do this...

Any ideas, please?

Thanks much,
Jim Berglund




Jim Berglund[_2_]

Current File
 
Thanks for your advice.

I just entered Workbook()1.Activate and it seemed to work!

Jim

"Jim Berglund" wrote in message
news:3ZtGf.466350$2k.393433@pd7tw1no...
I have a pricing spreadsheet which I typically modify and save for each
prospect under the account name. As such, I have t go into the code and
replace all the current filename references.

There must be a better way to do this...

Any ideas, please?

Thanks much,
Jim Berglund





All times are GMT +1. The time now is 11:52 AM.

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