Printer Object Quirk

Printer Object Quirk

You would think that the following code would change the current fontof the default printer, but it doesn’t under VB4:

 Printer.FontName = "Arial"Printer.FontSize = 11Printer.Print "This is a test."

An undocumented feature of VB4’s Printer object requires that each newpage be initialized before the font can be changed. This code works asexpected:

 ' Start new pagePrinter.Print' Set margins as desiredPrinter.ScaleMode = vbTwipsPrinter.CurrentY = 720' Now you can set the fontPrinter.FontName = "Arial"Printer.FontSize = 11Printer.Print "This is a test."Printer.EndDoc
See also  How HealthStream Learning Center Supports Healthcare Education and Compliance

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist