
Simple (?!) printing problem
I've got a form with a commondialog control and a button called "Print"
which invokes the following test code. However, one line does not print
at all, I only get 25 or so lines to the page in 10 point, the wrong
paper bin is seleted (it takes the top one, not the lower), and the font
is incorrect.
So, what am I doing wrong. It's so simple but I'm going nuts ... and
running out of paper!!!
Help please, someone!
Private Sub Print_Click()
With CommonDialog1
.ShowPrinter
Printer.Copies = .Copies
Printer.Orientation = .Orientation ' set to 1
Printer.PaperBin = vbPRBNLower ' set to 2 but upper tray
is selected
End With
pageTitle = "This is my page title"
With Printer
.ScaleMode = vbCentimeters
.Font.Name = "Times New Roman" 'lools like Arial
to me
.Font.Size = 10
.Width = 18
.Height = 27
.CurrentX = 2 + (18 - .TextWidth(pageTitle)) / 2
.CurrentY = 3 - .TextHeight(pageTitle) * 2
.FontBold = True
Printer.Print pageTitle ' This line is not
printed at all
.FontBold = False
.CurrentY = 3
For i = 0 To 100
.CurrentX = 2
Printer.Print "This is line " & i ' starts a new page at
line 22, line 50 etc
Next i ' and it's all in
Bold.
.EndDoc
End With
End Sub