Recover VBA Code using VBA (Visual Basic for Applications)
There is a possibility that you have created a solution using Excel VBA or any other Office Application, where you have secured your application in way where you allow user to access only interface that you have designed and user is restricted to access source or background information. If user dismiss the UI the application gets closed. Certainly the application launches a custom UI asking for UserName and Password and if you validate the same you will have access to the next level of information but at no stage user will be able to interact with other sheets or VBA code, sounds difficult but yes as a VBA Developer I have created such Excel Macros where I customized the Excel in a way so user can only follow the way I wish to.
Problem statement:
As mentioned, the application is fully protected, having Login Screen which is written on ThisWorkBook Open event, VBA Project is password protect and I (Developer) forgot the password. Ah???????
Solution:
Just write a peace of code in another workbook and you will have access to the source of your VBA code that you wish to retrieve.
- Just write the code to open your workbook in a different excel and debug it will launch your source workbook and Open Event will be fired in debug mode now you can modify the code as you wish
- Read/copy all the modules using VBE
Private Sub RecoverExcel() Dim wk As Workbook Set wk = Workbooks.Open("D:\Freelancer\Freelancer\RiverResidency\T.xlsm") Dim dst As VBIDE.CodeModule Set dst = wk.VBProject.VBComponents("ThisWorkbook").CodeModule End Sub
Next>>The number must be between 1 and 2147483647. Try again by entering a number in this range. Excel VBA