ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   macro reference changes with filename (https://www.excelbanter.com/excel-discussion-misc-queries/165084-macro-reference-changes-filename.html)

Louis Sweere

macro reference changes with filename
 
I've a workbook called argos.xls, which is the starting file.
In this workbook data is entered by the users and then saved by using a macro.
The filename is constructed from the data entered.

When this macro is run and the filename changes from argos.xls to
whatever.xls also the reference to that specific macro changes.
When opening argos.xls the macro reference is 'whatever.xls'!macro1. Since
the workbook is available through our network and users sometimes delete
files, I have to manually update the macro references.

Is there a way to prevent or lock the macro reference to the original
workbook?

Louis

joel

macro reference changes with filename
 
You should use THISWORKBOOK to refference worksheets in the same workbook as
the macro.

"Louis Sweere" wrote:

I've a workbook called argos.xls, which is the starting file.
In this workbook data is entered by the users and then saved by using a macro.
The filename is constructed from the data entered.

When this macro is run and the filename changes from argos.xls to
whatever.xls also the reference to that specific macro changes.
When opening argos.xls the macro reference is 'whatever.xls'!macro1. Since
the workbook is available through our network and users sometimes delete
files, I have to manually update the macro references.

Is there a way to prevent or lock the macro reference to the original
workbook?

Louis



All times are GMT +1. The time now is 10:47 AM.

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