Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Command Object

Visual Studio .NET 2003

Represents a command in the environment.

DTE

   Commands

      Command

[Visual Basic .NET]
Public Interface Command
    Inherits IDispatch
[Visual Basic 6]
Class Command
[C++]
interface Command : IDispatch
[C#]
public interface Command : IDispatch
[JScript .NET]
public interface Command extends IDispatch

Remarks

Reference this object using DTE.Commands.Item.

You can reference this object a number of ways, such as using the canonical name or the GUID ID. The easiest way to invoke most commands is by using DTE.ExecuteCommand. You can use Commands.Raise for the rare instances when you must invoke a command without a name.

Requirements

Namespace: EnvDTE

File: dte.tlb

Example

Sub CommandExample()
  ' Creates a text document listing all command names.
  Dim Cmd As Command
  Dim Doc As Document
  Dim TxtDoc As TextDocument

  ' Create a new text document.
  DTE.ItemOperations.NewFile ("General\Text File")
  Set Doc = ActiveDocument
  Set TxtDoc = Doc.Object("TextDocument")
  For Each Cmd In Commands
  If (Cmd.Name <> "") Then
    TxtDoc.Selection.Text = Cmd.Name & vbLF
    TxtDoc.Selection.Collapse
  End If
  Next
End Sub

See Also

Properties, Methods, and Events

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.