Then check the file size - see Stewbob's gotcha
Create a new simple excel file.
In the VBA part, set a simple password (say - 1234).
Now, open the excel file you need to see the VBA code in. The password for the VBA code
will simply be 1234 (as in the example I'm showing here).
Open the file you just created with a hex editor.
Save the excel file and exit.
As Treb says, it's a simple comparison. One method is to simply swap out the password entry in the file using a hex editor (see Hex editors for Windows). Step by step example:
Copy the lines starting with the following keys:
Excel 2007 password protection (and file format) is radically different than Excel 2003. I included some specifics about it in my answer below. In my opinion, the password protected option on an Excel 2007 file is the first time in Microsoft Office history that they have produced a reasonably secure file.
FIRST BACKUP the excel file you don't know the VBA password for, then open it with your hex editor, and paste the above copied lines from the dummy file.
If you need to work with Excel 2007 or 2010, there are some other answers below which might help, particularly these: 1, 2, 3.
In the blank excel file, or the locked one? Check the file size of the blank file. If its the locked file, make sure your backup is safe, then try changing just the other two lines. You sure it's encrypted file?
In the blank file. The other two lines do not appear either. Does this also work in Excel 2007? I used HEdit.
What if there are no lines that start with CMG=...?
Yes there is, as long as you are using a .xls format spreadsheet (the default for Excel up to 2003). For Excel 2007 onwards, the default is .xlsx, which is a fairly secure format, and this method will not work.