Things to remember while designing VSTO 2005 solutions

Programmatic Limitations of Host Controls

  • For each host item and host
    control there is an underlying native Word or Excel object which can be
    accessed via the InnerObject property of the host item or host
    control. You cannot however, cast a native object to it’s host
    item or host control.
  • Host items are not created
    automatically when you create a new document or worksheet at
    runtime. For example, if you add a Word document at run time, it
    will be of the type Microsoft.Office.Interop.Word.Document rather than
  • Host controls and Windows
    Forms controls cannot be added to a native Word document or Excel
    worksheet, they can only be added to a host item.
  • Most methods and properties of
    host items return the underlying native Office object upon which the item
    is based
  • VSTO does not provide
    individual collections for each type of host control. For example,
    it is not possible to enumerate each Microsoft.Office.Tools.Word.Bookmark
    control in the document using the Microsoft.Office.Interop.Word.Bookmarks
    collection. You can use the ControlCollection to iterate through all
    controls (host controls and Windows Forms controls) on the document and
    then look for items that match the type of host control that you are
    interested in
  • In Microsoft Word, you can
    pass a host control to a method or property that requires a native Word
    object for which there is a corresponding host control. However, in
    Excel, you must pass the native Office object rather than the
    corresponding host control. You can use the InnerObject property of
    the host control to pass the native Office object
  • If a user deletes or cuts a
    control from the document at run time, the control cannot be restored by
    using the Undo or Paste methods. The Undo and Paste operations will
    add the underlying native Office object back to the document, but the
    object is no longer a host control.


Managed Windows Forms Controls

  • Controls can be added either
    manually or programmatically
  • Controls can be added to a
    Windows form, the actions pane, or directly on the document.
  • Windows Forms controls are not
    supported inside of a header or footer, or within a subdocument.


The following controls and components are
not available in the Toolbox and are not supported for use on documents in VSTO

  • BindingNavigator
  • ContextMenuStrip
  • CrystalReportViewer
  • DataGrid
  • DirectoryEntry
  • DirectorySearcher
  • ErrorProvider
  • EventLog
  • FileSystemWatcher
  • FlowLayoutPanel
  • GroupBox
  • MainMenu
  • MenuStrip
  • MessageQueue
  • NotifyIcon
  • PageSetupDialog
  • Panel
  • PerformanceCounter
  • PrintDialog
  • PrintDocument
  • PrintPreviewControl
  • Process
  • RichTextBox
  • SerialPort
  • ServiceController
  • SplitContainer
  • Splitter
  • StatusBar
  • StatusStrip
  • TabControl
  • TableLayoutPanel
  • System.Timers.Timer
  • System.Windows.Forms.Timer
  • ToolBar
  • ToolStrip
  • ToolStripContainer
  • ToolStripDropDown
  • ToolStripDropDownMenu
  • ToolStripPanel


Unsupported methods and properties of Word

  • Hide
  • Show
  • Anchor
  • Dock
  • Location
  • TabIndex
  • TabStop
  • TopLevelControl
  • Visible

Unsupported methods and properties of
Excel controls

  • Anchor
  • Dock
  • Location
  • TabIndex
  • TabStop
  • TopLevelControl