Custom control resets after restart of Corel

Hi, using the code below I create a control to run my macro from the toolbox bar. It is being created with the right icon. When I restart Corel then icon is gone to the Corel default one. Also gone is the caption/descriptiontext/tooltiptext, but the macro itself will still run when being clicked. I thought maybe the button has to be registered in any way or the toolbar needs to be updated but I could'nt find proper methods for that within the Control/CommandBar classes.

Anyone know what this is caused by?

Thanks!

Sub createMacroButtons()

    Dim cb As CommandBar
    Set cb = FindCommandBarByName("Toolbox")
    
    If cb Is Nothing Then Exit Sub
    
    Dim oButton As Control
    Set oButton = cb.Controls.AddCustomButton("Makros", "Test.Maße", cb.Controls.Count)
    oButton.Caption = "Maße"
    oButton.DescriptionText = "Maße"
    oButton.ToolTipText = "Maße"
        
    'does not work, why?
    'oButton.SetCustomIcon Application.GMSManager.UserGMSPath & "icon.ico"
        
    oButton.SetIcon2 Application.GMSManager.UserGMSPath & "icon.ico"

End Sub

Private Function FindCommandBarByName(name As String) As CommandBar

    Dim i As Long
    
    For i = 1 To Application.CommandBars.Count
    
        If (Application.CommandBars.Item(i).name = name) Then
            Set FindCommandBarByName = Application.CommandBars.Item(i)
            Exit Function
        End If
        
    Next
    
    Set FindCommandBarByName = Nothing
    
End Function

Parents
No Data
Reply Children
No Data