C
Craig
I have a toolbar that runs macros from a locked project of an .xls
file that is always in a standard location. In this .xls file, under
the ThisWorkbook page, one subroutine is:
Private Sub Workbook_Open()
If Not DEVELOPER Then
Me.ChangeFileAccess Mode:=xlReadOnly
EndIf
EndSub
This is to prevent people from editing the .xls file with the macros
unless they set the DEVELOPER flag to true, which can only be done if
you have the password to unlock the project. If this flag is set to
false, as it is by default, as soon as you click a toolbar button, the
workbook for the .xls file containing the macros will open in the
background, run this routine and set itself to read-only.
This worked fine with Excel 2000. However, when we switched over to
Excel 2003, when you click the toolbar button and accept the security
warnings, it says "Compile error in hidden module: ThisWorkbook".
After more security warnings, it says it can't find the macro (I'm
assuming this is only because of the former error). As soon as I
unlock the project for viewing, everything works fine. Can anybody
tell me how to fix this (other than the obvious setting the file as
read-only rather than doing it in the code)?
Thanks in advance.
file that is always in a standard location. In this .xls file, under
the ThisWorkbook page, one subroutine is:
Private Sub Workbook_Open()
If Not DEVELOPER Then
Me.ChangeFileAccess Mode:=xlReadOnly
EndIf
EndSub
This is to prevent people from editing the .xls file with the macros
unless they set the DEVELOPER flag to true, which can only be done if
you have the password to unlock the project. If this flag is set to
false, as it is by default, as soon as you click a toolbar button, the
workbook for the .xls file containing the macros will open in the
background, run this routine and set itself to read-only.
This worked fine with Excel 2000. However, when we switched over to
Excel 2003, when you click the toolbar button and accept the security
warnings, it says "Compile error in hidden module: ThisWorkbook".
After more security warnings, it says it can't find the macro (I'm
assuming this is only because of the former error). As soon as I
unlock the project for viewing, everything works fine. Can anybody
tell me how to fix this (other than the obvious setting the file as
read-only rather than doing it in the code)?
Thanks in advance.