I have tried to write a procedure to preserve the state of the Word Task pane when a new blank document is created.

The task pane is a dogs breakfast in the Word object model, no disrespect to dogs intended.

It appears as an item in the CommandBars collection where it's visiblilty can be set. However it is not really a commandbar since it does not have most of the properties of a command bar.

There is also a TaskPanes Collection which has 5 items. But the 'New document' pane is not one of these! Also there are 8 types of pane in the user interface drop-down box.

I cannot find a what is wrong with the following code which gets a run-time error when attempting to set the task pane to visible.

Sub NewPreserveTaskPane()
Dim blnPaneVisible As Boolean
Dim docCurrent As Document
Dim docNew As Document

Set docCurrent = ActiveDocument
blnPaneVisible = docCurrent.CommandBars("Task Pane").Visible

Set docNew = Documents.Add(DocumentType:=wdNewBlankDocument)