CustomTaskPane.VisibleStateChange event (Office)

Occurs when the user changes the visibility of the custom task pane.

Syntax

expression.VisibleStateChange (CustomTaskPaneInst)

expression An expression that returns a CustomTaskPane object.

Parameters

Name Required/Optional Data type Description
CustomTaskPaneInst Required CustomTaskPane The active task pane.

Example

The following example, written in C#, creates a custom task pane and adds an ActiveX button control created in another project. A VisibleStateChange event of type _CustomTaskPaneEvents_VisibleStateChangeEventHandler is defined in the procedure. When the event is triggered, the event handler displays a message box depending on whether the task pane is currently visible or hidden.

object missing = Type.Missing; 
public CustomTaskPane CTP = null; 
 
public void CTPFactoryAvailable(ICTPFactory CTPFactoryInst) 
{ 
 CTP = CTPFactoryInst.CreateCTP("SampleActiveX.myControl", "Task Pane Example", missing); 
 sampleAX = (myControl)CTP.ContentControl; 
 sampleAX.InsertTextClicked += new InsertTextEventHandler(sampleAX_InsertTextClicked); 
 CTP.Visible = true; 
 
 CTP.VisibleStateChange += new _CustomTaskPaneEvents_VisibleStateChangeEventHandler(CTP_VisibleStateChange); 
} 
 
private void CTP_VisibleStateChange(object sender, string visiblestateArgs) 
{ 
 if (CTP.Visible) 
 { 
 Console.WriteLine("The custom task pane is now visible"); 
 } 
 else 
 { 
 Console.WriteLine("The custom task pane has been hidden"); 
 } 
} 

Note

You can create custom task panes in any language that supports COM and allows you to create dynamic-linked library (DLL) files; for example, Microsoft Visual Basic 6.0, Visual Basic .NET, Visual C++, Visual C++ .NET, and Visual C#. However, Microsoft Visual Basic for Applications (VBA) does not support creating custom task panes.

See also

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.