Crack any SOLIDWORKS password-protected VBAmacro with screenshots

Amen Jlili

Disclaimer: The information shared in this article is intended to show how easy it is to unlock the password protection of any SOLIDWORKS VBA macro. Please do not use this for any other reason.

Unlock any VBA macro in 5 mins

  • Well, to unlock a password-protect macro, we need to start by downloading this tool: HxD, a hexadecimal binary editor. This is going to help us patch one or two entries in the .swp file.
  • You probably have a password-protected VBA Macro while reading this article. If you don’t have a guinea pig, you can download this SOLIDWORKS VBA macro.
  • Make sure the macro is not being used by any application (i.e. SOLIDWORKS). This will prevent HxD from making changes to it.
  • Launch HxD:
HEX editor
  • in HxD, go to File > Open and then browse to the password-protected macro’s file and click on to open it:
HEX editor
  • Now, press Ctrl + F, and look for “DPB“. Usually, there is more than one occurrence.
  • Each occurrence of “DPB“, select the letter B and change it with x.
HEX editor
  • After replacing all occurrences of B with x in DPB, go to File and click on Save As.
  • Save the macro using a different name so you do not override the original one.
  • Open the macro in SOLIDWORKS by going to Tools > Macro > Edit…
  • You will get this message stating that the project file contains an invalid key “DPx’ and asks you if you want to continue loading the project. Click on Yes.
Password protection error when opening VBA macro
  • For each module in the main, the VBE will show this following dialog. Click on OK to confirm every single time.
VBE - Unexpected error 40230
  • When the VBE editor opens, go to Tools > Properties
How to get Tools > Properties in VBE
  • Go to the Protection and change the password and click OK.
VBA project properties
  • Make sure to save the macro.
  • Close and open SOLIDWORKS.
  • Edit the macro again and you should be able to view the source code with your new password.


What do I need to do to protect my code?

Unfortunately, not much. Macros are pretty awesome. Their security is not. Here at Blue Byte Systems, Inc, we encourage all of our customers to consider the option of upgrading their VBA macros to add-ins. We employ the latest code obfuscation tools to make it extremely hard for anyone to reverse engineer your code. Contact us more to get a quote on how to protect SOLIDWORKS VBA macro.

More great articles

Add watermark to your drawings – Macro

Add watermark macro in action. This macro adds a watermark to the active sheet of the active drawing document: 'www.bluebyte.biz…

Read Story
VBA LOGO

Traverse Assembly Tree Recursively -SOLIDWORKS API

This topic is most definitely a recurring one. I find myself having to go back to old pieces of code…

Read Story
SOLIDWORKS VBA vs SOLIDWORKS .NET

Top reasons to upgrade your VBA macros in 2020

Converting a SOLIDWORKS VBA macro to an add-in. VBA macros continue to be the choice of the SOLIDWORKS community for…

Read Story
Arrow-up
×