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

Delete all properties for the active configuration – SOLIDWORKS MACRO

The following macro deletes all the properties from the active configuration. The macro is written used late-binding so it is…

Read Story

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 PDM Professional: You have chosen to load a .Net Add-in? Well, what do you do next ?

SOLIDWORKS PDM Professional employs a server-client architecture. Your files and metadata is stored on the server (Archive server is where…

Read Story