0
votes

I am trying to obfuscate a word vba macro so they cannot copy it. Is there a way to make this possible? My source:

    Private Declare PtrSafe Function URLDownloadToFile Lib "urlmon" _
Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, _
ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long

Thank you.

1
Is password protecting the code not sufficient: stackoverflow.com/a/9425499/7599798 ? It's not 100% secure, you can find methods (using HexEditor) to remove the protection, but they are not easy to use.FunThomas

1 Answers

0
votes

You are free to create your own algorithm for replacing the variables names in the way you need it. But due to the fact that VBA is an interpreted language, you will have to leave most of the code as-is. You may find the following links helpful:

Also, you may protect your VBA macro with a password.

  1. press ALT+F11 to open the VBA editor.
  2. On the Tools menu, select Properties…
  3. On the Protection tab, select the Lock project for viewing check box.
  4. Enter and confirm a password.
  5. Click OK, and then close the VBA editor.

Be aware, it is easy to crack it down, see Is there a way to crack the password on an Excel VBA Project? for more information.