Sudden Erroring Appearing in HTLM Maker addin

NBVC

Well-known Member
Joined
Aug 31, 2005
Messages
5,828
Hi all,

I am suddenly getting an error message when I try to use Colo's HTML Maker Addin. I looked in the FAQ's and didn't see anything that could help. The error is a runtime error: 5 invalid procedure call or argument.

In this part of the HTML Maker Code (in the Mod_Menu module) the debugger highlights the following line:

Code:
Application.CommandBars(1).Controls(Caption).Delete

Has anybody got any ideas?

Note: I did try removing the addin and re-installing it from Colo's website but to no avail.


Code:
Sub DeleteMenu()
'   This sub should be executed when the workbook is closed
'   Deletes the Menus
    Dim MenuSheet As Worksheet
    Dim Row As Integer
    Dim Caption As String
    
    On Error Resume Next
    Set MenuSheet = ThisWorkbook.Sheets("MenuSheet")
    Row = 2
    Do Until IsEmpty(MenuSheet.Cells(Row, 1))
        If MenuSheet.Cells(Row, 1) = 1 Then
            Caption = MenuSheet.Cells(Row, 2)
            Application.CommandBars(1).Controls(Caption).Delete
        End If
        Row = Row + 1
    Loop
    On Error GoTo 0
End Sub
[/code]
 
Hi,

the error is probably: the "caption" doesn't exist
like you run
Code:
Application.CommandBars(1).Controls("abc").Delete

but
how could you get an error when there is "on error resume next" ?
 
...and also... I get this error when I first open a workbook.....

the code indicates that it will run when workbook is closed....

:confused:
 
couldn't reproduce your error
as said, it is strange it can occur while you have "on error resume next" :confused:
 
Okay, at the risk of looking stupid, I will post that I resolved this issue so that maybe the next person won't ask the same question and can learn from this....maybe this can be added to the FAQ's?

Erik's responses should have clued me in...but sometimes I am dense..... :unsure:

The problem was that somehow, my Options for error-handling in the VBE was set to Break on all Errors instead of Break on Unhandled errors.... :x
Now the Html Maker is working properly. :x I just figured it out reading a VBA book last night.

Although, the "band-aid" is on now, I am still wondering why the error would be triggered on this as it is supposed to execute upon closing of the workbook, yet the error happens upon opening.. :rolleyes:

Anyways, thanks Erik.. you have helped me yet again learn something new about VBA and the VBE. At least that's a plus for me.
 
you learned me something too :)
I never used the option "Break on all Errors"

as a security the "createmenu" has a line
Code:
Call DeleteMenu

hence the error on OPEN

best regards,
Erik
 
As long as we have learned from each other, then it was worth the post :wink:

Thanks again, Erik...always quick to reply and always very helpful...Cheers.
 

Forum statistics

Threads
1,214,929
Messages
6,122,314
Members
449,081
Latest member
tanurai

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top