ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Problem with a macro changing paths (https://www.excelbanter.com/excel-programming/353699-problem-macro-changing-paths.html)

[email protected]

Problem with a macro changing paths
 
Each month I update hundreds of reports (Excel Workbooks) and place
them on a shared network drive (K:\Library). To facilitate retrieval
of these reports I built a Report Selection menu. This is an Excel
file with a UserForm and numerous VB controls to select specific
reports. This menu is then placed on the end user's hard drive
(C:\Library). When the user needs a specific report they open the menu
and select their report. This in turn retrieves the report off the
share drive, and it pops up on the users screen. Everything is fine up
to here.

There is a 'Return to Library' Command Button on each report with a
macro that is supposed to close the report and return the user to a
specific page of the menu.

My problem is when anyone clicks the 'Return to Menu' Command Button it
returns an error stating the macro cannot be found. What is strange is
the path appearing in the error message indicates it is looking for the
'Return' macro on the share drive (K:\), when it is supposed to be
looking for the macro on the menu which is located on the C:\ drive.
When I check the Command Button and check Assign Macro sure enough the
Macro name has changed reflecting the correct folder and file names,
but it changed the drive from C:\ to the shared K:\. So I understand
the error since the macro does not reside where it is looking.

How do I correct the system so it 'locks' the location of the macro and
doesn't change paths.

Many thanks for any help

Tony


Tom Ogilvy

Problem with a macro changing paths
 
In the workbook_Open event, change the onaction property of the button to
point to the correct location.

--
Regards,
Tom Ogilvy


wrote in message
oups.com...
Each month I update hundreds of reports (Excel Workbooks) and place
them on a shared network drive (K:\Library). To facilitate retrieval
of these reports I built a Report Selection menu. This is an Excel
file with a UserForm and numerous VB controls to select specific
reports. This menu is then placed on the end user's hard drive
(C:\Library). When the user needs a specific report they open the menu
and select their report. This in turn retrieves the report off the
share drive, and it pops up on the users screen. Everything is fine up
to here.

There is a 'Return to Library' Command Button on each report with a
macro that is supposed to close the report and return the user to a
specific page of the menu.

My problem is when anyone clicks the 'Return to Menu' Command Button it
returns an error stating the macro cannot be found. What is strange is
the path appearing in the error message indicates it is looking for the
'Return' macro on the share drive (K:\), when it is supposed to be
looking for the macro on the menu which is located on the C:\ drive.
When I check the Command Button and check Assign Macro sure enough the
Macro name has changed reflecting the correct folder and file names,
but it changed the drive from C:\ to the shared K:\. So I understand
the error since the macro does not reside where it is looking.

How do I correct the system so it 'locks' the location of the macro and
doesn't change paths.

Many thanks for any help

Tony




[email protected]

Problem with a macro changing paths
 
Thanks Tom,

that did it...

Tony



All times are GMT +1. The time now is 08:49 AM.

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