ツールバーの形状制御

Public Sub ShowTool()
    Dim pDocument As IDocument
    Set pDocument = ThisDocument
    
    Dim pCommandBars As ICommandBars
    Set pCommandBars = pDocument.CommandBars
    
    Dim pCommandBar As ICommandBar
    Set pCommandBar = pCommandBars.Find("Project.講習会ツール") 'カスタムツールバー
    
    pCommandBar.Dock esriDockToggle
    Dim pWindowPosition As IWindowPosition
    
    Dim pWindowPosition2 As IWindowPosition
    Set pWindowPosition2 = Application
    
    If pCommandBar.IsVisible Then
      Set pWindowPosition = pCommandBar
      pWindowPosition.Width = 204
      ptoolbar.Dock esriDockFloat
      pWindowPosition.Top = (pWindowPosition2.Height - pWindowPosition.Height) / 2
      pWindowPosition.Left = pWindowPosition2.Width - pWindowPosition.Width - 10
      
    End If
      
End Sub