Results 1 to 2 of 2

Thread: Deleting Word CommandBarButton

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2008
    Posts
    100

    Deleting Word CommandBarButton

    I am pretty much following the tutorials I have found here in this forum.

    even have read this about getting rid of the dam thing.
    http://www.vbforums.com/showthread.php?t=347855

    If I unregister the .dll it is still in the "standard" commandbar of word.

    Could someone please tell me what I am doing wrong.

    Code:
    Public WithEvents wLuTTool As Office.CommandBarButton
    Code:
    Dim oPic As stdole.IPictureDisp
    Dim oMask As stdole.IPictureDisp
    
    
    '<LOAD THE PICTURE AND MASK OBJECTS>
    
    
    Set oPic = LoadResPicture(101, vbResBitmap)
    Set oMask = LoadResPicture(102, vbResBitmap)
    
    Set wLuTTool = w_App.CommandBars.Item("Standard").FindControl(, , "890", False, False)
    
    If TypeName(wLuTTool) = "Nothing" Then
        Set wLuTTool = w_App.CommandBars.Item("Standard").Controls.Add(msoControlButton, , "890", , False)
    End If
    
    
    With wLuTTool
        .BeginGroup = True
        .DescriptionText = "LuTTool - Add selected Word Document to IPAS"
        .Caption = "LuTTool"
        .Enabled = True
        .OnAction = "!<W2LTT2I.Connect>"
        .Style = msoButtonIconAndCaption
        .Picture = oPic  '<OFFICE 2000 - 2007>
        .Mask = oMask '<OFFICE 2002 - 2007>
        .Tag = "890"
        .ToolTipText = getMessage("ToolTip", user_language)
        .Visible = True
    End With
    
    Set oPic = Nothing
    Set oMask = Nothing
    Code:
    Private Sub IDTExtensibility2_OnBeginShutdown(custom() As Variant)
    
        'The OnBeginShutdown method is called while the environment is being shut down. The custom parameter is an array
        'that can be used to provide additional data to the OnBeginShutdown method if desired.
    
        If TypeName(wLuTTool) <> "Nothing" Then
            wLuTTool.Delete False
        End If
        Set wLuTTool = Nothing
    End Sub
    Code:
    Private Sub IDTExtensibility2_OnDisconnection(ByVal RemoveMode As AddInDesignerObjects.ext_DisconnectMode, _
    custom() As Variant)
    
    
    'The OnDisconnection method is called when the managed COM add-in is unloaded, such as when the user closes the
    'host application. The custom parameter is an array that can be used to provide additional data to the OnDisconnection
    'method if desired. The RemoveMode parameter is an ext_dm constant that indicates how the managed COM add-in was unloaded.
    If TypeName(wLuTTool) <> "Nothing" Then
        wLuTTool.Delete False
    End If
    Set wLuTTool = Nothing
    End Sub
    In the above I have been playing around with the Temporary property of the button it is "False" in the above but I have also tried "True" which is originally what it was.

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Aug 2008
    Posts
    100

    Re: Deleting Word CommandBarButton

    Found this from microsoft. In short I found the button in the shutdown and after deleting I am saving normal.dot.

    http://support.microsoft.com/kb/230876

    might be something to add to the forum FAQ's for WORD Add-ins that an add-in is playing with at least normal.dot but can play with all .dots.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width