Comment imprimer tous les contenus de MSFlexGrid1 directement

Résolu
sportmed Messages postés 194 Date d'inscription mardi 15 mai 2007 Statut Membre Dernière intervention 25 janvier 2014 - 10 juin 2012 à 14:32
sportmed Messages postés 194 Date d'inscription mardi 15 mai 2007 Statut Membre Dernière intervention 25 janvier 2014 - 11 juin 2012 à 14:31
bonjours,
Bonjour,

J'ai besoin d'aide pour imprimer les informations concernant:

Comment imprimer tous les contenus de MSFlexGrid1 directement sans avoir recours à des programmes de Crystal Reports.
Le bouton Imprimer. Imprimé directement toutes les informations disponibles dans les MSFlexGrid1


VB 6.0

1 réponse

sportmed Messages postés 194 Date d'inscription mardi 15 mai 2007 Statut Membre Dernière intervention 25 janvier 2014 2
11 juin 2012 à 14:31
Private Sub Imprimer_Click()
 On Error Resume Next
 Dim NbLigne As Long
 Dim Y As Double
 Dim X As Double
 Dim I As Long
 Dim j As Integer
 Dim Txt As Variant
 Dim NbPages As Integer
 Dim Rep As String
 Dim NumPage As Integer
 'grille=msflexgrid'
 Printer.ScaleMode = 7
 Printer.ScaleHeight = 29.7
 Printer.ScaleWidth = 21
Printer.Font = "arial"
 NbLigne = Me.LISTEVENTEGLOBAL.Rows
 NbPages = Int((NbLigne / 32) + 1)
 Rep = InputBox("Préparez votre imprimante pour environ " & NbPages & " pages.", "OUI")
If Rep <> "oui" Then
 Exit Sub
End If
 Y = 1
 NumPage = 1
For I = 0 To Me.LISTEVENTEGLOBAL.Rows
 Y = Y + 0.4
 'position des colonnes'
 Printer.CurrentX 1: Printer.CurrentY Y: Printer.Print Me.LISTEVENTEGLOBAL.TextMatrix(I, 1)
 Printer.CurrentX 8: Printer.CurrentY Y: Printer.Print Me.LISTEVENTEGLOBAL.TextMatrix(I, 2)
 Printer.CurrentX 11: Printer.CurrentY Y: Printer.Print Me.LISTEVENTEGLOBAL.TextMatrix(I, 3)
 Printer.CurrentX 14: Printer.CurrentY Y: Printer.Print Me.LISTEVENTEGLOBAL.TextMatrix(I, 4)
 Printer.CurrentX 17: Printer.CurrentY Y: Printer.Print Me.LISTEVENTEGLOBAL.TextMatrix(I, 5)
If I > 1 Then
 Y = Y + 0.3
 For j = 1 To 17
 Printer.CurrentY Y: Printer.CurrentX j: Printer.Print "_________";
 Next j
End If
If Y > 27 Then
 Printer.CurrentX 1: Printer.CurrentY 28: Printer.Print "Page " & NumPage
 Y = 1
 NumPage = NumPage + 1
 Printer.EndDoc
 Y = 1
End If
 Next I
 Printer.CurrentX 1: Printer.CurrentY 28: Printer.Print "Fin/Page " & NumPage
 Printer.EndDoc
End Sub


1
Rejoignez-nous