ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to lock the path to a macro (https://www.excelbanter.com/excel-programming/285095-how-lock-path-macro.html)

JVS

How to lock the path to a macro
 
Can someone tell me how I can lock the path to a macro that I assigned to a
command button?

Every time I copy the spread sheet from the server to my hard drive the path
to the macro is changed

to match the location of the work book.

Using Excel 2000.



Thanks!
Johnny





BrianB

How to lock the path to a macro
 
No. "It is a feature, not a bug." <<grin

Regards
BrianB
==============================================


"JVS" wrote in message ...
Can someone tell me how I can lock the path to a macro that I assigned to a
command button?

Every time I copy the spread sheet from the server to my hard drive the path
to the macro is changed

to match the location of the work book.

Using Excel 2000.



Thanks!
Johnny


JVS

How to lock the path to a macro
 
Is there a work around or an alternate solution?
I have a time sheet workbook that I am about to issue to approx 200
associates.
I'd like to issue it with no macro's, but was hoping to use a command button
to link to a second "master book" that would contain the macros required to
fix what the users mess up.

Any help would be greatly appreciated!
Thanks!
Johnny

"BrianB" wrote in message
om...
No. "It is a feature, not a bug." <<grin

Regards
BrianB
==============================================


"JVS" wrote in message

...
Can someone tell me how I can lock the path to a macro that I assigned

to a
command button?

Every time I copy the spread sheet from the server to my hard drive the

path
to the macro is changed

to match the location of the work book.

Using Excel 2000.



Thanks!
Johnny




Walt Weber

How to lock the path to a macro
 
Hi Johnny,

Have you considered opening a ReadOnly copy of the Master
Book and shifting it behind the Slave Book? If it's
open, your button clicks won't need a path (See below).
The following may give you some ideas:

'SlaveBook.xls
'IN A SHEET OBJECT
Private Sub CommandButton1_Click()
Call OpenMaster
End Sub

Private Sub CommandButton2_Click()
'USE SOME VALID MasterBook.xls PROCEDURE HERE
Application.Run "MasterBook.xls!TstMasterSub"
'NO PATH REQUIRED HERE
End Sub


'SlaveBook.xls
'IN A MODULE
'CALL FROM A BUTTON CLICK, AUTO_OPEN, OR??
Sub OpenMaster()
Application.ScreenUpdating = False
Workbooks.Open _
Filename:="\\your\fixed\path\to\MasterBook.xls", _
ReadOnly:=True
ThisWorkbook.Activate
End Sub


'SlaveBook.xls
'IN THE WORKBOOK OBJECT
'DON'T LEAVE THE MASTERBOOK.XLS FILE OPEN ALONE
Private Sub Workbook_BeforeClose(Cancel As Boolean)
For Each wb In Workbooks
If wb.Name = "MasterBook.xls" Then _
wb.Close savechanges:=False
Next
End Sub


'MasterBook.xls
'IN THE WORKBOOK OBJECT
Private Sub Workbook_Open()
If Workbooks.Count = 1 Then
ThisWorkbook.Close savechanges:=False
Else
'TRIGGER ANY VALID AUTO_OPENS HERE
MsgBox "Master Book Opened"
End If
End Sub

Best Regards,
Walt Weber


-----Original Message-----
Is there a work around or an alternate solution?
I have a time sheet workbook that I am about to issue to

approx 200
associates.
I'd like to issue it with no macro's, but was hoping to

use a command button
to link to a second "master book" that would contain the

macros required to
fix what the users mess up.

Any help would be greatly appreciated!
Thanks!
Johnny

"BrianB" wrote in message
. com...
No. "It is a feature, not a bug." <<grin

Regards
BrianB
==============================================


"JVS" wrote in message

.. .
Can someone tell me how I can lock the path to a

macro that I assigned
to a
command button?

Every time I copy the spread sheet from the server to

my hard drive the
path
to the macro is changed

to match the location of the work book.

Using Excel 2000.



Thanks!
Johnny



.



All times are GMT +1. The time now is 06:41 PM.

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