Excel 2007 Add-in Error when opening a password-protected file

G

Greg S.

This is my first post to the forums.

I am running Excel 2007 SP2 under Windows 7 Enterprise 64-bit. I have
written an Excel Add-in using the built-in VBA editor that adds a new tab to
the Ribbon. On the tab are a few buttons, toggles, text boxes, and labels.
I've then saved the file as a .xlam and copied it to my local PC's "add-ins"
folder.

Normally, when I launch Excel (either from it's icon or by opening a normal
Excel document), the add-in loads properly and everything works as expected.

But if Excel is not running and I try to open an Excel file that is password
protected from the shell (i.e. double-clicking the document icon in Explorer,
rather than File->Open in Excel), I am greeted to 2 "critical" (red X) error
dialog boxes that have no title and no description, along with the dialog to
enter the password to unlock the document, when Excel launches. If I click
OK on the two errors and enter my password, the document opens correctly and
my custom tab is added to the Ribbon. However, none of the code behind my
custom Ribbon buttons work.

Things I've tried or noticed:
- The error is definitely related to the add-in modifying the Ribbon. If I
disable that Add-in, the errors do not pop-up.
- If I add the same Add-in to Excel 2007 running on Windows XP Pro 32-bit, I
do not get the errors and the add-in loads properly. This makes me think it
is either a Windows 7 or 64-bit issue.
- If I put a 'debug.print err.number' and 'debug.print err.description' code
as the first 2 lines in my 'onLoad' function, I see '0' and a blank like
printed when these errors occur. (I get nothing printed if Excel opens
properly). However, code that gets the handle to the IRibbon control does
not seem to execute.
- Likewise, if I put a 'Stop' as the first line in the onLoad, it does not
break there.
- If I take out the XML for the onLoad statement altogether, I still get the
errors.
- I also get this error when trying to open a document from SharePoint if
Excel asks for my credentials. (i.e. the Windows/IE password dialog opens.)
- These errors do NOT occur if I open Excel first (with a blank workbook)
and then open any of the password-protected documents, presumably because the
Add-in has already successfully initialized.

I would appreciate any help anyone can offer with these errors using Excel
2007 on Win7 64-bit.
Thank you!

-- G
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top