DebugConsole class

The IDE’s DEBUG CONSOLE pane — reached through Host.DebugConsole. The canonical place for an addin to write diagnostic and log output.

With Host.DebugConsole
    .PrintText "[MyAddIn] Project: " & Host.CurrentProject.Name
    .PrintText "[MyAddIn] Compiler: " & Host.CompilerVersion
    .PrintText "[MyAddIn] PID: "      & Host.IDEProcessID
End With

The pane is shared across the IDE’s own output and every addin’s output — prefix log lines with an addin tag (e.g. "[MyAddIn] ") so users can distinguish the sources.

Methods

Clear

Clears the entire content of the DEBUG CONSOLE pane.

Syntax: debugConsole.Clear

PrintText

Prints one line of text to the pane.

Syntax: debugConsole.PrintText Prompt [, ColorRGB ]

Prompt
required The text to print. String.
ColorRGB
optional The text colour as an RGB Long (use the RGB(r, g, b) function to construct one). Default 0.
Host.DebugConsole.PrintText "Operation completed"                           ' default colour
Host.DebugConsole.PrintText "Warning: something looks off", RGB(255, 128, 0) ' orange
The DEBUG CONSOLE with the two lines Operation completed and Warning: something looks off, both drawn in the same yellow.The DEBUG CONSOLE with the two lines Operation completed and Warning: something looks off, both drawn in the same yellow.

Note BETA 1045

ColorRGB has no effect: every line an addin prints is drawn in the yellow of the IDE’s own message lines, whatever the value, as the picture shows for the sample’s orange line.

SetFocus

Gives keyboard focus to the DEBUG CONSOLE’s text-entry point — equivalent to the user clicking into the console.

Syntax: debugConsole.SetFocus