![excel vba project unviewable unlock excel vba project unviewable unlock](https://www.isunshare.com/images/article/excel-password/unprotect-xls-xlsx-worksheet-without-password/select-excel-sheet-in-vba-to-unprotect.png)
MoveMemory ByVal VarPtr(TmpBytes(0)), ByVal pFunc, osi+1 If VirtualProtect(ByVal pFunc, 12, PAGE_EXECUTE_READWRITE, OriginProtect) 0 Then If Flag Then MoveMemory ByVal pFunc, ByVal VarPtr(OriginBytes(0)), 12 Private Function GetPtr(ByVal Value As LongPtr) As LongPtr Private Declare PtrSafe Function DialogBoxParam Lib "user32" Alias "DialogBoxParamA" (ByVal hInstance As LongPtr, _īyVal pTemplateName As LongPtr, ByVal hWndParent As LongPtr, _īyVal lpDialogFunc As LongPtr, ByVal dwInitParam As LongPtr) As Integer
![excel vba project unviewable unlock excel vba project unviewable unlock](https://i0.wp.com/www.excelsupersite.com/wp-content/uploads/2021/06/UnprotectVBAProjectWithoutPassword_03.png)
Private Declare PtrSafe Function GetProcAddress Lib "kernel32" (ByVal hModule As LongPtr, _
![excel vba project unviewable unlock excel vba project unviewable unlock](https://i.stack.imgur.com/9DwDs.png)
Private Declare PtrSafe Function GetModuleHandleA Lib "kernel32" (ByVal lpModuleName As String) As LongPtr Private Declare PtrSafe Function VirtualProtect Lib "kernel32" (lpAddress As LongPtr, _īyVal dwSize As LongPtr, ByVal flNewProtect As LongPtr, lpflOldProtect As LongPtr) As LongPtr (Destination As LongPtr, Source As LongPtr, ByVal Length As LongPtr) Private Declare PtrSafe Sub MoveMemory Lib "kernel32" Alias "RtlMoveMemory" _ Working version for 64-bit Windows/Office Option Explicit If you want to make your project really uncrackable see this post. MyDialogBoxParam = DialogBoxParam(hInstance, pTemplateName, _ Private Function MyDialogBoxParam(ByVal hInstance As Long, _ MoveMemory ByVal pFunc, ByVal VarPtr(HookBytes(0)), 6 MoveMemory ByVal VarPtr(HookBytes(1)), ByVal VarPtr(p), 4 MoveMemory ByVal VarPtr(OriginBytes(0)), ByVal pFunc, 6 MoveMemory ByVal VarPtr(TmpBytes(0)), ByVal pFunc, 6 If VirtualProtect(ByVal pFunc, 6, PAGE_EXECUTE_READWRITE, OriginProtect) 0 Then PFunc = GetProcAddress(GetModuleHandleA("user32.dll"), "DialogBoxParamA") If Flag Then MoveMemory ByVal pFunc, ByVal VarPtr(OriginBytes(0)), 6 Private Function GetPtr(ByVal Value As Long) As Long MsgBox "VBA Project is unprotected!", vbInformation, "*****" Private Declare Function DialogBoxParam Lib "user32" Alias "DialogBoxParamA" (ByVal hInstance As Long, _īyVal pTemplateName As Long, ByVal hWndParent As Long, _īyVal lpDialogFunc As Long, ByVal dwInitParam As Long) As Integer Private Declare Function GetProcAddress Lib "kernel32" (ByVal hModule As Long, _ Private Declare Function GetModuleHandleA Lib "kernel32" (ByVal lpModuleName As String) As Long Private Declare Function VirtualProtect Lib "kernel32" (lpAddress As Long, _īyVal dwSize As Long, ByVal flNewProtect As Long, lpflOldProtect As Long) As Long (Destination As Long, Source As Long, ByVal Length As Long) Private Declare Sub MoveMemory Lib "kernel32" Alias "RtlMoveMemory" _ Private Const PAGE_EXECUTE_READWRITE = &H40 I will also provide the code here just in case it gets deleted from stackoverflow. I’ve made it’s VBA project unviewable using this method. It creates an additional button on Developer tab in Excel Ribbon. Apparently credit goes to Vietnamese developer nicknamed Siwtom or Đức Thanh Nguyễn and I believe this is his YouTube channel.Īll you need to do is to run Sub UnprotectVBA() – this will crack the VBA password on all files currently opened in given Excel instance.īased on this code I’ve prepared UnlockVBA add-in which can be downloaded from here. This method works with all Excel files and does not require any third party software.Īll we need is this piece of code I’ve found on. The below described method should not be used to steal someone’s hard work – it can be only applied if you forgot the password to your own VBA project or for educational purposes.
![excel vba project unviewable unlock excel vba project unviewable unlock](https://www.educba.com/academy/wp-content/uploads/2019/10/VBA-Editor-in-Excel.png)
Remember that if VBA code is protected, it’s protected for a reason.