View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
PeteSmith PeteSmith is offline
external usenet poster
 
Posts: 9
Default COM Error Hiding/Showing Excel Toolbars

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