How to completely hide an Excel sheet — the VeryHidden method is not secure because the VBA project password can be hacked.
Thanks!
How to completely hide an Excel sheet — the VeryHidden method is not secure because the VBA project password can be hacked.
Thanks!
365
if you need robust protection of your VBA, use commercial third party tools.
Copilot have some suggestions:
If you're serious about locking down your Excel VBA code, Arnel, there are a few standout commercial tools that go far beyond simple password protection. Here’s a breakdown of the top contenders:
️ 1. XLS Padlock
- What it does: Compiles your VBA code into bytecode and embeds it in a protected workbook.
- Key features:
- Prevents access to the VBA editor entirely
- Converts macros into binary code (not just obfuscation)
- Supports licensing, activation keys, and trial versions
- Best for: Developers distributing Excel-based applications who want strong protection without leaving the VBA ecosystem.
- Explore XLS Padlock
2. DoneEx VBA Compiler for Excel
- What it does: Translates your VBA code into C-language and compiles it into a native Windows DLL.
- Key features:
- Highest level of protection — code is completely removed from the workbook
- Supports trial/demo versions and registration keys
- Boosts performance for some VBA routines
- Best for: Advanced users who want impenetrable protection and are comfortable with DLL integration.
- Check out DoneEx VBA Compiler
️*️ 3. Unviewable+
- What it does: Makes your VBA project permanently unviewable in the editor.
- Key features:
- Multiple protection levels (Simple to Ultimate)
- Multi-layer protection for add-ins
- Easy to use interface
- Best for: Quick protection without compilation; ideal for Excel add-ins and templates.
- Learn about Unviewable+
Actually 'Tom Foolery' , Im guessing that you all ready knew this like almost all users of excel, but you somehow wanted other to think you are an idiot. Congratulations for being the prime suspect
Remember To Do the Following....
Use [Code].... [/Code] tags when posting code to the thread.
Mark your thread as Solved if satisfied by using the Thread Tools options.
If posting the same issue to another forum please show the link
Last edited by georgiboy; Today at 02:18 AM. Reason: Removed spam
You could for example hide a worksheet by having the workbook read data from another workbook either open or closed There are two common scenarios:
If the source workbook is already open, VBA can easily access its sheets directly.
If the source workbook is closed, you can still read from it using ADO or Excel formulas. Here's an ADO example:Sub HideSheetsBasedOnOpenWorkbook() Dim srcWB As Workbook Dim wsName As String Dim i As Long ' Set reference to the open workbook Set srcWB = Workbooks("SourceWorkbook.xlsx") ' Change name as needed ' Loop through list of sheet names in column A of Sheet1 With srcWB.Sheets("Sheet1") i = 1 Do While .Cells(i, 1).Value <> "" wsName = .Cells(i, 1).Value On Error Resume Next ThisWorkbook.Sheets(wsName).Visible = xlSheetVeryHidden On Error GoTo 0 i = i + 1 Loop End With End Sub
Add a reference: Tools > References > Microsoft ActiveX Data Objects x.x Library.
File must not be password-protected or filtered.
Again, a reasonably competent person will overcome this issue in time.Sub HideSheetsFromClosedWorkbook() Dim cn As Object, rs As Object Dim wbPath As String Dim sql As String Dim sheetName As String wbPath = "C:\Path\To\Your\SourceWorkbook.xlsx" ' <<-- Update this ' Setup connection Set cn = CreateObject("ADODB.Connection") Set rs = CreateObject("ADODB.Recordset") cn.Open "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & wbPath & ";" & "Extended Properties='Excel 12.0 Xml;HDR=YES';" sql = "SELECT [Sheet1$].[SheetName] FROM [Sheet1$]" rs.Open sql, cn Do Until rs.EOF sheetName = rs.Fields(0).Value On Error Resume Next ThisWorkbook.Sheets(sheetName).Visible = xlSheetVeryHidden On Error GoTo 0 rs.MoveNext Loop rs.Close: cn.Close Set rs = Nothing: Set cn = Nothing End Sub
You can prompt the User to choose the source workbook at runtime. This makes your code dynamic and user-friendly, with no hardcoding of the name required. This concept will fail if there's a requirement to multi read from the source workbook.
However, over time a competant person will eventually over come this issue as well. Microsoft clearly made the decision to enhance ease of use over security when the designing things for Excel.Sub HideSheets_FromUserSelectedWorkbook() Dim srcWB As Workbook Dim fd As FileDialog Dim filePath As String Dim wsName As String Dim i As Long ' Ask user to select the source workbook Set fd = Application.FileDialog(msoFileDialogFilePicker) With fd .Title = "Select Source Workbook" .Filters.Clear .Filters.Add "Excel Files", "*.xls; *.xlsx; *.xlsm; *.xlsb" .AllowMultiSelect = False If .Show <> -1 Then Exit Sub ' User cancelled filePath = .SelectedItems(1) End With ' Open the source workbook read-only Set srcWB = Workbooks.Open(filePath, ReadOnly:=True) ' Loop through list of sheet names in column A of Sheet1 With srcWB.Sheets(1) ' or use .Sheets("Sheet1") i = 1 Do While .Cells(i, 1).Value <> "" wsName = Trim(.Cells(i, 1).Value) On Error Resume Next ThisWorkbook.Sheets(wsName).Visible = xlSheetVeryHidden On Error GoTo 0 i = i + 1 Loop End With ' Close the source workbook without saving srcWB.Close SaveChanges:=False MsgBox "Specified sheets have been hidden based on " & vbCrLf & filePath, vbInformation End Sub
Remember To Do the Following....
Use [Code].... [/Code] tags when posting code to the thread.
Mark your thread as Solved if satisfied by using the Thread Tools options.
If posting the same issue to another forum please show the link