Export (0) Print
Expand All
ID
Top
Expand Minimize

IsAvailable Property

Visual Studio .NET 2003

Returns whether or not the command is currently enabled.

[Visual Basic .NET]
Public ReadOnly Property IsAvailable() As Boolean
[Visual Basic 6]
Property Get IsAvailable() As Boolean
[C++]
HRESULT __stdcall get_IsAvailable(
   /* [out, retval] */ VARIANT_BOOL* retVal
);
[C#]
public bool IsAvailable {get;}
[JScript .NET]
public function get IsAvailable() : Boolean

Return Value

Returns True if the command is currently enabled, False if otherwise.

Example

Sub IsAvailableExample()
   ' Before running, you must add a reference to the Office 
   ' typelib to gain access to the CommandBar object.
   Dim cmds As Commands
   Dim cmdobj As Command
   Dim customin, customout As Object
   Dim colAddins As AddIns

   ' Set references.
   colAddins = DTE.AddIns()
   cmds = DTE.Commands
   cmdobj = cmds.Item("File.NewFile")

   ' List some of the command properties.
   MsgBox("Command Name: " & cmdobj.Name)
   MsgBox("Is Command Available?: " & cmdobj.IsAvailable)
   MsgBox("Command ID: " & cmdobj.ID)
   MsgBox("Command GUID: " & cmdobj.Guid)
End Sub

See Also

Applies To: Command Object

Show:
© 2014 Microsoft