Microsoft Visual Basic Printer Objects Methods


Methods 

 

By far the most widely used Printer object methods are the Print, EndDoc, and NewPage methods.     Once you master these three methods, you'll rarely need to use any other methods.

 

Circle:

Draws a circle, an ellipse, or an arc on the printer.

 

EndDoc:

Releases the current document, in full, to the print spooler for output.

 

KillDoc:

Immediately terminates the output and deletes the current print job from the print spooler.

 

Line:

Draws lines and boxes on the page.

 

NewPage:

Sends a page break to the printed output so that subsequent output appears on the next page.

 

PaintPicture:

Draws a graphic image file on the printer.

 

Print:

Prints numeric and text data on the printer.

 

PSet:

Draws a graphical point on the printed output.

 

Scale:

Determines the scale used for measuring output.

 

ScaleX:

Converts the printer's width to ScaleMode's measurement unit.

 

ScaleY:

Converts the printer's height to ScaleMode's measurement unit.

 

TextHeight:

Determines the full height of text given in the scale set with Scale.


TextWidth:

Determines the full width of text given in the scale set with Scale.



Format :  [Printer.]Print [Spc(n) | Tab(n)] Expression


Ex:


  Printer.Print "for Windows easy."

  FirstName = "Charley"


  Age = 24


  Printer.Print FirstName

  Printer.Print Age


  By using the semicolon, you can force these values to print next to each  other:


Printer.Print "The sales were "; 4345.67

Printer.Print strFirstName; Spc(10), strLastName

Printer.Print Tab(50), dteDateGenerated


  ScaleMode values


0 = vbUser

A user-defined value


1 = vbTwips

Measured in twips (the default)


2 = vbPoints

Measured in points


3 = vbPixels

Measured in pixels (the smallest unit addressable by your printer)


4 = vbCharacters

Measured in characters (120x240 twips)


5 = vbInches

Measured in inches


6 = vbMillimeters

Measured in millimeters


7 = vbCentimeters

Measured in centimeters


Ex:


  Printer.ScaleMode = 1