Debug Console - Programming Examples

Table of Contents

LibreOffice

How to replace the Debug.Print() calls when porting VBA code into LibreOffice's OOBasic:

Option Compatible ' Declarations for 64-bit LibreOffice/OOBasic Private Declare Function ConsolePrint Lib "ssdbgcons64.dll" (ByVal text As String) As Long Private Declare Function ConsoleColor Lib "ssdbgcons64.dll" (ByVal r As Byte, ByVal g As Byte, ByVal b As Byte) As Long Private Declare Function ConsoleClear Lib "ssdbgcons64.dll" () As Long Private Declare Function ConsoleFont Lib "ssdbgcons64.dll" (ByVal font As String) As Long Private Declare Function ConsoleFontSize Lib "ssdbgcons64.dll" (ByVal size As Long) As Long Private Declare Function ConsoleShow Lib "ssdbgcons64.dll" (ByVal show As Long) As Long Private Sub test() ConsoleClear ConsoleShow 1 ' -2 = hide, -1 = minimize, 0 = restore, 1 = topmost, 3 = not-topmost ConsoleFont "System" ConsoleFontSize 10 ConsoleColor 255, 200, 0 ConsolePrint "Text" & vbCrLf ' Use this line instead of Debug.Print in LibreOffice Basic End Sub

Microsoft Office

How to use the Console in Microsoft Office/VBA:

' Declarations for 64-bit Microsoft Office 2007-2016 and standalone version of MS 365 Private Declare PtrSafe Function ConsolePrint Lib "ssdbgcons64.dll" (ByVal text As String) As Long Private Declare PtrSafe Function ConsoleColor Lib "ssdbgcons64.dll" (ByVal r As Byte, ByVal g As Byte, ByVal b As Byte) As Long Private Declare PtrSafe Function ConsoleClear Lib "ssdbgcons64.dll" () As Long Private Declare PtrSafe Function ConsoleFont Lib "ssdbgcons64.dll" (ByVal font As String) As Long Private Declare PtrSafe Function ConsoleFontSize Lib "ssdbgcons64.dll" (ByVal size As Long) As Long Private Declare PtrSafe Function ConsoleShow Lib "ssdbgcons64.dll" (ByVal show As Long) As Long Private Sub test() ConsoleClear ConsoleFontSize 20 ConsoleColor 255, 0, 0 ConsolePrint "Text" & vbCrLf End Sub

FAQ

How to implement the Debug.Print calls in LibreOffice?

Import the ConsolePrint() function from our Debug Console DLL and replace the Debug.Print calls with the DebugPrint:

Private Declare Function ConsolePrint Lib "ssdbgcons64.dll" (ByVal text As String) As Long Private Sub DebugPrint(s As String) ConsolePrint s & vbCrLf End Sub

How to use the Debug Console from VB6 or other 32-bit apps?

The smallest possible code to easily replace the Debug.Print() calls:

Private Declare Function ConsolePrint Lib "ssdbgcons32.dll" (ByVal text As String) As Long Private Sub DebugPrint(s As String) ConsolePrint s & vbCrLf End Sub Private Sub test() ' Replace the Debug.Print calls with the DebugPrint in your code ' Debug.Print "Test message" DebugPrint "Test message" End Sub

What is the point to use your console in VB6 or MS Office?

You don't need to open the VBA window and then open the Immediate window. This console remains visible all the time. You can show diagnostic messages to the end-user without asking him to open the VBA debugger.

You can control the console visibility from your code.

You can use tray balloons instead of the console window.

You can print colored messages for warnings or select a fixed font to print tables.

You can log the console messages to a text file. The logging can be controlled from your code.

Facebook X Bluesky Youtube Contacts

© 2026 StrokeScribe. All rights reserved. Use of any portion of this site constitutes acceptance of our Terms of Use and Privacy Policy. The website material may not be reproduced, except with the prior written permission.