This documentation is archived and is not being maintained.

VCCodeMacro Interface 

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

Namespace: Microsoft.VisualStudio.VCCodeModel
Assembly: Microsoft.VisualStudio.VCCodeModel (in microsoft.visualstudio.vccodemodel.dll)

[GuidAttribute("17730D49-271F-11D7-8BF6-00B0D03DAA06")] 
public interface VCCodeMacro
/** @attribute GuidAttribute("17730D49-271F-11D7-8BF6-00B0D03DAA06") */ 
public interface VCCodeMacro
GuidAttribute("17730D49-271F-11D7-8BF6-00B0D03DAA06") 
public interface VCCodeMacro

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

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

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)
    MsgBox(vcMacro.DisplayName)
End Sub
Show: