Re: Addin Close problem

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Tom Ogilvy (twogilvy_at_msn.com)
Date: 02/13/05


Date: Sun, 13 Feb 2005 10:05:13 -0500

Nothing obvious in the code you show, but obviously this routine doesn't
trigger itself since it isn't an event. Your next area to look is at
whatever triggers this routine. If you can find no calls, then look at any
events you have that might trigger the routine. Easier might be to fix the
routine that causes the error so that it doesn't cause the error - if it is
otherwise harmless in this scenario.

-- 
Regards,
Tom Ogilvy
"S G Booth" <sgbooth@totalise.co.uk> wrote in message
news:O2T3oxZEFHA.3972@TK2MSFTNGP15.phx.gbl...
> I have an addin which creates its' own menu item on loading, and deletes
it
> on closing, but an error is raised when I shut excel down.
>
> So I set a break point at the start of the following code:
>
> Sub RemoveBofQ_UtilitiesMenu()
> '   This sub should be executed when the workbook is 'closed
> '   Deletes the Menus
>     Dim MenuSheet As Worksheet
>     Dim Row As Integer, Caption As String
>
>     On Error Resume Next
>     Set MenuSheet = ThisWorkbook.Sheets _
>             ("BofQUtilitiesMenu")
>     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
>
> The sub executes correctly, but when it ends, it jumps into another sub in
a
> standard module in the addin and runs it,
> which raises the error.
>
> How is this 2nd sub being called.....what can I look for,
> please?
>
> Regards.
>
>


Relevant Pages

  • Next Emptycell row #
    ... Is there a simplified vba code for the following routine? ... Sub test() ... Dim row, NextRow As Long ...
    (microsoft.public.excel.misc)
  • Re: Using Kill Statements in Modules
    ... What event is supposed to trigger the code being run? ... Presumably you put the code in a Function or Sub: just call that routine in ... What am I missing? ...
    (microsoft.public.access.modulesdaovba)
  • RE: Routine running slow (memory leak?)
    ... In the first sub, ListAuditResults, I set up the 3 past ranges using the Set ... of no memory leak) as I need them all the time until the routine ends. ... it would never run again and I could put "Set Hardrng = Nothing" ... Dim PasteStartCell As String ...
    (microsoft.public.excel.programming)
  • Re: Err object being reset and returning err.number = 0
    ... I've already changed the errorhandler so that it takes the parameters ... As for leaving out the "Exit Sub" statement, that was a habit that I ... The routine originally used an On Error Resume Next. ... > which are specifically designed for use inside an error handler. ...
    (microsoft.public.word.vba.general)
  • Re: Err object being reset and returning err.number = 0
    ... I've already changed the errorhandler so that it takes the parameters ... As for leaving out the "Exit Sub" statement, that was a habit that I ... The routine originally used an On Error Resume Next. ... > which are specifically designed for use inside an error handler. ...
    (microsoft.public.vb.com)