'Print Text With Specific Alignment
'Preparations
'Add 1 Command Button to your form.
'Form Code
Public Sub PrintAlignedText(s As String, Alignment As String)
Select Case Alignment
Case "Center"
Printer.CurrentX = (Printer.ScaleWidth - Printer.TextWidth(s)) \ 2
Case "Left"
Printer.CurrentX = 0
Case "Right"
Printer.CurrentX = Printer.ScaleWidth - Printer.TextWidth(s)
End Select
Printer.Print s
' use the EndDoc command if this text is the last thing you want
' to print on the paper
Printer.EndDoc
End Sub
Copyright By AccessVision
|