Link to home
Start Free TrialLog in
Avatar of sdwalker
sdwalkerFlag for United States of America

asked on

Error 91 when invalidating control for Office 2007 customized ribbon

I have a small excel add-in that I wrote with a Dynamic Menu.  The idea is to create a 'permanent' set of favorites that people can set on their individual machines.  

The available selections on the menu are ...
  - Add spreadsheet to Favorites
 - Manage Favorites
 - or select one of many spreadsheets that have already been added as favorites, which will then open that spreadsheet.

When you Add a spreadsheet to favorites, it populates a worksheet in the addin with the Short Description of the spreadsheet and the full path and filename of the spreadsheet.    The last thing it does is invalidates the dynamic menu control so that when the control is selected, it will be re-loaded, the new spreadsheet will appear in the list.  

The good news is that this add-in works on my machine.  The bad news is that it does not work on my co-worker's machine.  I am getting a run-time error '91' .. 'Object variable or With block variable not set'.  I have attached screenshots below.

Please let me know if you need more info.

Thanks,

sdwalker
clip-image001.jpg
clip-image002.jpg
clip-image003.jpg
Avatar of Rory Archibald
Rory Archibald
Flag of United Kingdom of Great Britain and Northern Ireland image

How and where do you initialize the rxIRibbonUI variable?
Avatar of sdwalker

ASKER

Thanks for the question.  

rxIRibbonUI is initialized per image below.

sdwalker
ee1.jpg
That is .. it's just dimensioned as a Public Variable in one of the modules.

sdwalker
That doesn't show me how it is initialised, only how it is declared. I need to see the code that actually assigns an IRibbonUI object to the variable.
Given that it's a public variable, it's possible that an error has cleared its value when your other user is testing it.
Sorry about that.  Here is the initialization and I've included also included the xlam for your perusal.  You will need to remove the .jpg from the end of the file.

Thanks,

sdwalker
ee2.jpg
xlFavorites.zip
Sorry - I didn't seem to get a notification of your last response. I've had a look and the add-in works fine for me, and I can't see anything wrong with the code.
Does it always break at the same place for your coworker and does he/she have any other add-ins loaded? Also, if you check the option to display add-in user interface errors on his machine, do you get any additional errors?
Sorry rorya, we've upgraded to Office 2007 at work now and I've been supporting our production spreadsheets.  I finally got installed on 3 co-workers machines.  Two of them break at the exact same spot, while the 3rd one works, albeit is very clunky.  You have to actually close Excel and re-open it to see the Favorites that you've added.  

It is not this way on my machine at all.  

Any ideas?

Thanks,

sdwalker
I doubt if I can help you much, but I did find this article which states, in part:

The object is a valid object, but it wasn't set because the object library
in which it is described hasn't been selected in the References dialog box.
Select the object library in the Add References dialog box.

http://www.daniweb.com/forums/thread51526.html
SOLUTION
Avatar of Rory Archibald
Rory Archibald
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Also, rorya, if you think the completed addin would be useful to you, I'll send it to you.  Just tell me the best way to do it.

sdwalker
I'm not sure I added much, if anything, to the solution, so I don't want any points, but I'd agree it's worth keeping in the knowledgebase. I'm fine with you accepting your own answer, though I would like to see the finished product if that's OK with you! :)
Rory
Certainly, rory.  I actually attempted to give you 100 points for your efforts in helping me, but it wouldn't let me do that but still accept my own solution.  I have emailed the final product to you.  Please let me know if you don't receive it soon.

Thanks again!

sdwalker
Got it, thanks. Will take a look when I get a chance!
Rory