how to refer to a workbook which name changes over time?

  • Thread starter Thread starter MJKelly
  • Start date Start date
M

MJKelly

Hi,

How can I refer to a workbook in a macro if the name of the workbook
changes over time? The workbook contains most of the data I use to
create new workbooks, however its name is changed to reflect the
version (date) of the data it contains. If I refer to the name in the
module and then the name changes the following week the macro won't
work (obviously).

Any ideas? I thought that maybe the name could be identified when the
workbook opens and that name is assigned to variable? (I am new at
this).

kind regards,
Matt
 
Hi,

How can I refer to a workbook in a macro if the name of the workbook
changes over time? The workbook contains most of the data I use to
create new workbooks, however its name is changed to reflect the
version (date) of the data it contains. If I refer to the name in the
module and then the name changes the following week the macro won't
work (obviously).

Any ideas? I thought that maybe the name could be identified when the
workbook opens and that name is assigned to variable? (I am new at
this).

kind regards,
Matt

Hi Matt,

In your code, replace the name of the workbook that the macro runs in
with ThisWorkbook.

Sincerely,
Leith Ross
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top