ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Changing macro source (https://www.excelbanter.com/excel-programming/272542-changing-macro-source.html)

Steve Boyer

Changing macro source
 
I wrote a proceedure in Excel 97 with links to 25 seperate
files of code and user forms, all stored in one folder.
When the proceedure file is moved to a different folder or
drive, or saved in a different folder or drive, Excel will
change the macro link source to look in the folder or
drive in which it was moved. I know I can change the link
source, but there are approximately 25 people using this
proceedure, storing it in their own filing system, which
created error when opening "cannot find file". Is there
any way to disable the automatic changing of the link
source so it will always look in the same folder and drive
for the macros?

Steve Smallman

Changing macro source
 
Steve,

when you specify the files, did you include a path, or assume that the
filenames would always be in the current folder?

When designing for a network, I generally use a global constant to specify
the pathname of the target files. Place this in the module declarations and
it is a single point at which you can change the path for the relevant files

try adding 'global constant filepath ="\\server\folder\subfolder\ "' to the
declaration area
and then referencing the files as workbooks(filepath &"filename.xls")

Steve
"Steve Boyer" wrote in message
...
I wrote a proceedure in Excel 97 with links to 25 seperate
files of code and user forms, all stored in one folder.
When the proceedure file is moved to a different folder or
drive, or saved in a different folder or drive, Excel will
change the macro link source to look in the folder or
drive in which it was moved. I know I can change the link
source, but there are approximately 25 people using this
proceedure, storing it in their own filing system, which
created error when opening "cannot find file". Is there
any way to disable the automatic changing of the link
source so it will always look in the same folder and drive
for the macros?





All times are GMT +1. The time now is 03:54 PM.

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