Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
locking vba code
i have locked and password protected my code in a worksheet. when i remove
this worksheet from the worbook and save it the protection is not there. can anybody help thankyou john tempest |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
locking vba code
Protection is done at project level - so for the whole workbook.
I have never tried it, but if your project is protected and you can copy a sheet with code out of the workbook and the code is accessible, that sounds like a flaw in the protection scheme. I would expect either the sheet couldn't be copied or the code would not be copied with it. -- Regards, Tom Ogilvy "john tempest" wrote in message ... i have locked and password protected my code in a worksheet. when i remove this worksheet from the worbook and save it the protection is not there. can anybody help thankyou john tempest |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
locking vba code
this is the code i use to copy and save the worksheet,could there be a flaw
in the code Private Sub CommandButton1_Click() Dim wkbk As Workbook, sh As Worksheet Worksheets("MANUAL TS").Copy Set wkbk = ActiveWorkbook ' get rid of all cell formulas For Each sh In wkbk.Worksheets With sh.UsedRange .Value = .Value 'getrid of command button' ActiveSheet.OLEObjects("CommandButton1").Delete 'protect sheet' ActiveWorkbook.Sheets("MANUAL TS").Protect Password:="AABAABABBBAW" End With Next wkbk.SaveAs "C:\Documents and Settings\Administrator\My Documents\HOWDENS\TIMESHEET\ " & Sheets("MANUAL TS").Range("B5") & ".xls" wkbk.Close End Sub any ideas thankyou john tempest "Tom Ogilvy" wrote: Protection is done at project level - so for the whole workbook. I have never tried it, but if your project is protected and you can copy a sheet with code out of the workbook and the code is accessible, that sounds like a flaw in the protection scheme. I would expect either the sheet couldn't be copied or the code would not be copied with it. -- Regards, Tom Ogilvy "john tempest" wrote in message ... i have locked and password protected my code in a worksheet. when i remove this worksheet from the worbook and save it the protection is not there. can anybody help thankyou john tempest |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
locking vba code
I ran your code with the project protected for viewing in the VBE and it did
copy the worksheet and its code (the code in the sheet module) to the new workbook and the code was able to be viewed. I guess you will have to expand your code to strip the code in the copy. See Chip Pearson's page on this and related topics http://www.cpearson.com/excel/vbe.htm -- Regards, Tom Ogilvy "john tempest" wrote in message ... this is the code i use to copy and save the worksheet,could there be a flaw in the code Private Sub CommandButton1_Click() Dim wkbk As Workbook, sh As Worksheet Worksheets("MANUAL TS").Copy Set wkbk = ActiveWorkbook ' get rid of all cell formulas For Each sh In wkbk.Worksheets With sh.UsedRange .Value = .Value 'getrid of command button' ActiveSheet.OLEObjects("CommandButton1").Delete 'protect sheet' ActiveWorkbook.Sheets("MANUAL TS").Protect Password:="AABAABABBBAW" End With Next wkbk.SaveAs "C:\Documents and Settings\Administrator\My Documents\HOWDENS\TIMESHEET\ " & Sheets("MANUAL TS").Range("B5") & ".xls" wkbk.Close End Sub any ideas thankyou john tempest "Tom Ogilvy" wrote: Protection is done at project level - so for the whole workbook. I have never tried it, but if your project is protected and you can copy a sheet with code out of the workbook and the code is accessible, that sounds like a flaw in the protection scheme. I would expect either the sheet couldn't be copied or the code would not be copied with it. -- Regards, Tom Ogilvy "john tempest" wrote in message ... i have locked and password protected my code in a worksheet. when i remove this worksheet from the worbook and save it the protection is not there. can anybody help thankyou john tempest |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
locking vba code
One way to work around this problem is to obfuscate (= replace with
functionally equivalant, but much harder to understand) the VBA code within the entire Workbook. That way, even if they get at your code, it's much harder for them to understand it. An open source Excel/VBA source code obfuscation Add-in is available at: http://invisiblebasic.sourceforge.net Just use the Add-in's "Save Invisibly As" command before sending out your workbook. John |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
row locking, instead of file locking? | Excel Discussion (Misc queries) | |||
locking formula in cells in without locking whole sheet | Excel Discussion (Misc queries) | |||
Locking Code In Individual Macros | Excel Discussion (Misc queries) | |||
Locking VBA code via Project properties but cannot save the workbook over itself | Excel Programming | |||
Code for locking windows | Excel Programming |