I have quite a simple VB6 project. It has a textbox called "txtCustomer" and another textbox called "txtNumBoxes". Basically just type in an address to txtCustomer and a number into txtNumBoxes and click Print, and it will print simple address labels.
Problem is - it prints the first page in red text and every following page in black text. I want it all in red text and can't figure out why it starts printing in black instead. Can someone please correct the coding for me. Print coding below:
Problem is - it prints the first page in red text and every following page in black text. I want it all in red text and can't figure out why it starts printing in black instead. Can someone please correct the coding for me. Print coding below:
Code:
Private Sub cmdPrint_Click()
On Error GoTo ErrorHandler
If txtCustomer.Text = "" Then
MsgBox "Please enter delivery details.", vbExclamation, "Error"
Exit Sub
End If
If txtNumBoxes.Text = "" Then
MsgBox "Please enter box quantity.", vbExclamation, "Error"
Exit Sub
End If
Do Until intCurBox = intNumBoxes And intCurBox <> 0
strCustomer = txtCustomer.Text
intNumBoxes = txtNumBoxes.Text
Printer.PaperSize = vbPRPSA4
Printer.Orientation = vbPRORPortrait
Printer.ScaleMode = vbMillimeters
Printer.ColorMode = vbPRCMColor
Printer.ForeColor = &HFF
intCurBox = intCurBox + 1
Printer.CurrentX = 120
Printer.CurrentY = 1
Printer.Font = "Calibri"
Printer.FontSize = 48
Printer.ForeColor = &HFF
Printer.Print "Box " & intCurBox & " of " & intNumBoxes
Printer.CurrentX = 90
Printer.CurrentY = 27
Printer.Font = "Calibri"
Printer.FontSize = 22
Printer.ForeColor = &HFF
Printer.Print "Ship To:"
Printer.CurrentY = 44
Printer.Font = "Arial Black"
Printer.FontSize = 36
Printer.ForeColor = &HFF
Printer.Print strCustomer
Printer.CurrentX = 0
Printer.CurrentY = 138
Printer.FontSize = 12
Printer.Print "_________________________________________________________________________________________________________________________________________________________"
If intCurBox = intNumBoxes Then GoTo ExitLoop
intCurBox = intCurBox + 1
Printer.CurrentX = 120
Printer.CurrentY = 150
Printer.Font = "Calibri"
Printer.FontSize = 48
Printer.ForeColor = &HFF
Printer.Print "Box " & intCurBox & " of " & intNumBoxes
Printer.CurrentX = 90
Printer.CurrentY = 176
Printer.Font = "Calibri"
Printer.FontSize = 22
Printer.ForeColor = &HFF
Printer.Print "Ship To:"
Printer.CurrentY = 193
Printer.Font = "Arial Black"
Printer.FontSize = 36
Printer.ForeColor = &HFF
Printer.Print strCustomer
Printer.NewPage
ExitLoop:
Loop
Printer.EndDoc
Unload Me
End
Exit Sub
ErrorHandler:
Debug.Print "Error: " & Err.Number
Debug.Print "Description: " & Err.Description
Debug.Print "Source: " & Err.Source
End Sub