Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printer Object Problem

Status
Not open for further replies.

willrae

Programmer
Sep 13, 2002
22
GB
I am using the Printer.Page in my code. The problem is it is keeping it's value between runs! Here is the code. You can see the use of Page to check whether it's the first page or not. I run this code, stop the application, and run it from the IDE, and I find Page has kept it's value!!!

nolabelsacross = Text1 'in
nolabelsdown = Text2 'in
LabelsPerPage = nolabelsacross * nolabelsdown
NoLabels = UBound(m_Labels)
sheetHLS = HLS
sheetVLS = VLS
'Printer.KillDoc
Dim x As Printer
For i = 1 To NoLabels
'new page?
partpage = (i - 1) Mod LabelsPerPage
If partpage = 0 And Printer.Page <> 1 Then 'start of new page
Printer.NewPage
End If
'get page itemno
itemno = i - ((Printer.Page - 1) * LabelsPerPage)
'get Row No. for Label
CompleteRows = itemno \ nolabelsacross
PartRows = itemno Mod nolabelsacross
If PartRows > 0 Then ' round up part
RowNo = CompleteRows + 1
Else
RowNo = CompleteRows ' this is end of row
End If
'get Column No. for item
PartRow = itemno Mod nolabelsacross
If PartRow = 0 Then 'end
ColNo = nolabelsacross
Else
ColNo = PartRow
End If
lblx = LabelX(ColNo, sheetHLS)
lbly = LabelY(RowNo, sheetVLS)
Printer.CurrentX = lblx
Printer.CurrentY = lbly
Printer.Print m_Labels(i)
Next
Printer.EndDoc

 
This line : If partpage = 0 And Printer.Page <> 1
should be If partpage = 0 And i <> NoLabelsPerPage (I think)

It's still being debugged, but this problem is preventing me do it.
 
Should be If partpage = 0 And i - 1 <> 0
Might enable you to understand it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top