View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
joel joel is offline
external usenet poster
 
Posts: 9,101
Default 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