CreepyD
asked on
Password protect a xlsm file with VBA macros
Since we now have all Office 2007 (and 2010 beta in some cases), I have started using it's improved functionality - It does the same in both 2007 and 2010 beta.
I have a xlsm workbook which has a self updating 'table' in it.
The file is quite locked down, and has a menu page with buttons. These contain very simple macros like this:
Sub Macro1()
Sheets("sheetname").Select
End Sub
There are 5 of these.
When I try to save the file with the password on it, I get this error:
"This workbook contains Excel 4.0 or Excel 5.0 modiles. If you would like to password protect or restrict permission to this document, you need to remove these macros."
I have spent a good couple of hours researching ways around this, with no luck so far.
I can't use .xls as I want to use the 'table' feature.
I am saving this file in a 'trusted location' (as set in the trust center).
I also have 'Enable all macros' and 'Trust access to the VBA project object model' set.
I wonder if there is some registry hack to get around this problem?
We could use other methods for this particular document, (unhide sheet tabs, and show only the one's we want to access) but that's not the point - We have LOTS of other files with more complex macros so I would like a solution rather than a work around.
Thanks!
I have a xlsm workbook which has a self updating 'table' in it.
The file is quite locked down, and has a menu page with buttons. These contain very simple macros like this:
Sub Macro1()
Sheets("sheetname").Select
End Sub
There are 5 of these.
When I try to save the file with the password on it, I get this error:
"This workbook contains Excel 4.0 or Excel 5.0 modiles. If you would like to password protect or restrict permission to this document, you need to remove these macros."
I have spent a good couple of hours researching ways around this, with no luck so far.
I can't use .xls as I want to use the 'table' feature.
I am saving this file in a 'trusted location' (as set in the trust center).
I also have 'Enable all macros' and 'Trust access to the VBA project object model' set.
I wonder if there is some registry hack to get around this problem?
We could use other methods for this particular document, (unhide sheet tabs, and show only the one's we want to access) but that's not the point - We have LOTS of other files with more complex macros so I would like a solution rather than a work around.
Thanks!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
That should not be necessary - the macros do not belong in the ThisWorkbook module, they belong in a normal module - and should not in fact make any difference. Could you post one of these files? (remove any data)