Recently I have been having problems with commandbars in all spreadsheets.
I downloaded the add a menu spreadsheet from royUK's website and when I open it I get...
Run-time error 91
Object variable or With bolck variable not set
...and on debug the line in red
I guess the red does not show up...the first line after Do
Private Sub DeleteCustomCommandBarControl(CustomControlTag As String)
' deletes ALL occurences of commandbar controls with a tag = CustomControlTag
On Error Resume Next
Do
Application.CommandBars.FindControl(, , CustomControlTag, False).Delete Loop Until _
Application.CommandBars.FindControl(, , CustomControlTag, False) Is Nothing
On Error GoTo 0
End Sub
This file has opened fine in the past, but as of late I get this error. When I close the spreadsheet I get the run time error 91 again.
Also, try to open Richard Schollar's HTML maker and I get...
Run-time error 5
Invalid procedure call or argument
...and on debug the line in red
I guess the red does not show up...the first line after On Error
Sub CleanUp()
Dim cbc As CommandBarControl
On Error Resume Next
Set cbc = Application.CommandBars("Worksheet Menu Bar").Controls("MrExcelHtml") If Not cbc Is Nothing Then
I have other spreadsheets which use commandbars and I get errors. I've tried to narrow it down and can get the commandbar to show up by adjusting certain aspects of the code, but it seems the problem is coming for the removing of the commandbar on close.
Any thoughts?
Bookmarks