VCCodeMacro Object

VCCodeMacro Object

Visual Studio .NET 2003

An object representing a macro (#define statement) code element in the source code of a solution.

[Visual Basic .NET]
Public Interface VCCodeMacro
   Inherits IDispatch
[Visual Basic 6]
Class VCCodeMacro
interface VCCodeMacro : IDispatch
public interface VCCodeMacro : IDispatch
[JScript .NET]
public interface VCCodeMacro extends IDispatch


The VCCodeMacro object represents the #define code element. Primarily, the object is used to access or modify the elements of an existing macro.


Namespace: Microsoft.VisualStudio.VCCodeModel

File: vcpkg.dll


This example retrieves the first VCCodeMacro object of the current solution and displays it in a message box. It assumes a default MFC project is open.

Sub GetFirstMacro()
    Dim vcCM As VCCodeModel
    Dim vcMacro As VCCodeMacro
    vcCM = DTE.Solution.Item(1).CodeModel
    vcMacro = vcCM.Macros.Item(1)
End Sub

See Samples for Code Model Extensibility for information on how to compile and run this sample.

See Also

VCCodeMacro Object Properties, Methods, and Events | Visual C++ Extensibility Object Model

© 2015 Microsoft