COM Error Hiding/Showing Excel Toolbars

P

PeteSmith

I am trying to hide or show Excel Toolbars form VB.Net automation but keep getting Com exceptions on the code below
The error message typically says call rejected by callee, and I can sometimes determine which commandbar is being referred to from the watch window, but not always.
it started to occur when trying to restore visibility of toolbars on closing application, but now also occures on hiding
Code I'm using is as follows
For y = 1 To xlapp.CommandBars.Coun
If CStr(xlapp.CommandBars(y).NameLocal) <> "Worksheet Menu Bar" The
If xlapp.CommandBars(y).Visible The
ReDim Preserve xlTBarNames(x
xlTBarNames(x) = xlapp.CommandBars(y).NameLocal.ToStrin
x +=
End I
End I
Next
 

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