ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   COM Error Hiding/Showing Excel Toolbars (https://www.excelbanter.com/excel-programming/297898-com-error-hiding-showing-excel-toolbars.html)

PeteSmith

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


All times are GMT +1. The time now is 10:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com