This project has moved. For the latest updates, please go here.

Linking Ribbon Control with Custom Task Pane

May 17, 2013 at 9:28 AM

I am trying to link the control of a checkbox in the ribbon to toggle the custom task pane visibility status. I believe I am almost there however missing a step or 2.

Assistance would be greatly appreciated thanks
Private taskPane As Office._CustomTaskPane
Private ctpFactory As Office.ICTPFactory

Private Const taskPane_PROGID As String = "Advance Tools with Custom Task Pane"

Shared _application As Word.Application

Shared myuserControl As UserControl1

Public Sub CTPFactoryAvailable(ByVal CTPFactoryInst As Object) Implements NetOffice.OfficeApi.ICustomTaskPaneConsumer.CTPFactoryAvailable

    ctpFactory = CTPFactoryInst

End Sub

Public Sub CheckBox1_Pressed(ByVal control As Office.IRibbonControl, ByVal CheckBox1State As Boolean)

    If CheckBox1State Then

        taskPane = ctpFactory.CreateCTP(GetType(Addin).Assembly.GetName().Name + ".UserControl1", "Picture Table Editor", Type.Missing)
        taskPane.DockPosition = MsoCTPDockPosition.msoCTPDockPositionFloating
        taskPane.Width = 300
        taskPane.Height = 420
        taskPane.Visible = True
        taskPane.DockPosition = MsoCTPDockPosition.msoCTPDockPositionLeft
        taskPane.Width = 300
        myuserControl = taskPane.ContentControl


        taskPane.Visible = False

    End If

End Sub