How to Find a VBA Password

Written by stephanie ellen
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Find a VBA Password
Unlock your VBA code by hacking the password. (Jupiterimages/Brand X Pictures/Getty Images)

Visual Basic for Applications (VBA) is a programming language for Microsoft Office. When you write VBA within your Office applications, you may not want other users to see or modify your VBA code. The solution is to place password protection on your VBA files. Once you've placed a password on the file, Microsoft's strong encryption will prevent anyone from accessing the file. If you lose your password, Microsoft won't help you get it back; the tough encryption may mean your database is lost forever. However, there is a little-known workaround.

Skill level:

Other People Are Reading


  1. 1

    Press "Alt" and "F11" from within the Office application you want to get the VBA password for. For example, press "Alt" and "F11" together in Access.

  2. 2

    Click "Insert" and then click "New Module."

  3. 3

    Press "Ctrl" and "G" together to open the debug window.

  4. 4

    Type "? StPasswordOfStDatabase("c:\desktop\myfile.mdb")" into the debug window.

  5. 5

    Replace "c:\desktop\myfile.mdb" with the path name to your database. The code as written will return the password for a file called "myfile" located on the Desktop.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.