How to dock the Styles Task Pane in the e-mail editing window?

Not open for further replies.


Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
I'm looking for VBA code to dock the Styles Task Pane to the right side of the mail editing window.
In Word 2010 I can do this with this code:

With Application.TaskPanes(wdTaskPaneFormatting)
If .Visible = False Then .Visible = True
CommandBars("Task Pane").Position = 2 'msoBarRight
End With

But I can't figure out how to do this in Outlook 2010 VBA.

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
this opens it (but docking is causing an error) - code samples taken from Use a Default Subject for New Messages and Use Word Macro to Apply Formatting to Email

' Based on
Private WithEvents m_Inspectors As Outlook.Inspectors
Private WithEvents m_Inspector As Outlook.Inspector

Private Sub Application_Startup()
  Set m_Inspectors = Application.Inspectors
End Sub

Private Sub m_Inspectors_NewInspector(ByVal Inspector As Outlook.Inspector)
  Set m_Inspector = Inspector
End Sub

Private Sub m_Inspector_Activate()
    Dim objWord As Word.Application
    Dim objDoc As Word.Document
    Dim objItem As Object
    Dim objInsp As Outlook.Inspector
Set objItem = m_Inspector.CurrentItem
Set objInsp = objItem.GetInspector
If objInsp.EditorType = olEditorWord Then
    Set objDoc = objInsp.WordEditor
    Set objWord = objDoc.Application
With objWord.TaskPanes(wdTaskPaneFormatting)
If .Visible = False Then .Visible = True

'  objWord.CommandBars("Task Pane").Position = 2 'msoBarRight
End With
End If
  Set m_Inspector = Nothing

End Sub
Not open for further replies.