Salve a tutti.
Ho preso dal forum un codice in grado di creare codici a barre.
Tutto ok, metto un numero di 13 cifre nel testo e mi genera il codice
Ho provato a stampare l'intera form (quindi anche il codice a barre generato) e ho notato che mi stampa i bottoni, le text box, tranne il codice a barre.
Come mai?
In fin dei conti sono linee bianche e nere da stampare!
Il codice che ho usato per stampare è codicibarre.PrintForm
dove codicibarre è il nome della form.

Grazie 1000 per l'aiuto.

PS Il codice che disegna il codice a barre è questo:

Private Sub Code3of9(sToCode As String, pPaintInto As Form, Y1 As Long, Y2 As Long)
Dim sValidChars As String, sValidCodes As String
Dim lElevate As Integer
Dim lCounter As Long, lWkValue As Long, PosX As Long, PosY1 As Long, PosY2 As Long
Dim TPX As Long

TPX = Screen.TwipsPerPixelX

sValidChars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%*"
sValidCodes = "41914595664727860970419025962647338417105957" + _
"84729059950476626106644590602984801043246599" + _
"62476744460260046477586109044686603224803443" + _
"91860130478424477058030365265828235758580903" + _
"65863556658042365383495434978353624150635770"

sToCode = UCase(IIf(Left(sToCode, 1) = "*", "", "*") + sToCode + IIf(Right(sToCode, 1) = "*", "", "*"))
PosX = ((((Me.Width / TPX) - (Len(sToCode) * 16)) / 2) * TPX) - 1
PosX = PosX - 180
PosY1 = Y1 'PosY1 = pPaintInto.Height * 0.2
PosY2 = Y2 'PosY2 = pPaintInto.Height * 0.8

If PosX < 0 Then
MsgBox "The length of the code exceeds control limits.", vbExclamation, "Large string"
GoTo End_Code
End If

On Error Resume Next

For lCounter = 1 To Len(sToCode)
'Here is where the number is fetched from the sValidCodes string. It will get only 5 digits.
lWkValue = Val(Mid(sValidCodes, ((InStr(1, sValidChars, Mid(sToCode, lCounter, 1)) - 1) * 5) + 1, 5))
lWkValue = IIf(lWkValue = 0, 36538, lWkValue)

For lElevate = 15 To 0 Step -1
'It evaluates the binary number to see if it has to draw a line.
If lWkValue >= 2 ^ lElevate Then
pPaintInto.Line (PosX, PosY1)-(PosX, PosY2)
lWkValue = lWkValue - (2 ^ lElevate)
End If
PosX = PosX + TPX
Next
Next
End_Code:
End Sub