How to Print Text with specific alignment
Posted on January 5, 2009
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 'Miscellaneous - How to Print Text with specific alignment Public Sub PrintAlignedText(ByVal S As String, ByVal 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() Call PrintAlignedText("http://codeitbetter.com", "Center") End Sub |