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
Private Sub Command1_Click()
' replace
the "hello" with the text you want to print.
' replace the
"Center" with your desirable alignment
' ("Center",
"Left" or "Right")
Call PrintAlignedText("hello",
"Center")
End Sub