Showing and Hiding the Actions Pane

The first time you add a control to the actions pane, the pane becomes visible to end users. If you want the actions pane to be visible as soon as the document is opened, you should write code that adds the control to the actions pane in the Startup event handler of the document (or workbook). If you want the actions pane to appear only when a user takes a particular action, you should add the code to the event handler of that action—for example, when the user right-clicks the document. If you do this, make sure that you add code to the Startup event handler of the document or workbook to detach the actions pane (which closes the Document Actions task pane) when the document is opened. If the user hasn't closed the task pane before saving and closing the document, an empty task pane might be visible on the document the next time it is opened. To detach the actions pane, use the following code:


Adding a control to the Controls collection of the ActionsPane causes it to be visible only the first time it is added. If you subsequently hide the task pane, as was shown in Listing 5.3, the act of adding another control to the Controls collection will not cause it to be visible. Instead, you must specifically show the task pane again the next time you add a control. For example, you must specifically write code to set the Visible property to true:

Application.CommandBars("Task Pane").Visible = True

0 0

Post a comment