Ben dans ton userform tu colles un picturebox en visible false au format A4R
tu mets le scale mode en cm et tu definit la hauteur et la largeur soit au format 29.7 x 21 ou moins en fonction des marges d'impression...
ensuite tu remplis ton picturebox avec une boucle par exemple:
for each control in Myuserform.controls
'et ici tu les bascule un a un dans le picturebox avec leur top, left value etc...
next
puis tu imprimes ton picbox:
printer.paintpicture Picturebox.image,coordX,coordY
avec coordX et coordY = 0,0
de cette façon tu utilises lobjet printer pour imprimer l'image contenue dans le picture box...
Sinon tu peux utiliser l'objet printer diretement en y construisant directement la page...
Ci-joint un exemple de code que tu dois pouvoir modifier en changeant les dimensions, le sens d'impression et le facteur zoom...
Option Explicit
Private Sub Command1_Click()
Const FacEch! = 1.5
Dim ContImprim As Control
Printer.ScaleMode = 6
Printer.Orientation = 2
Printer.PaperSize = 9
Printer.PrintQuality = -4
For Each ContImprim In Me.Controls
If TypeOf ContImprim Is Label Then
With Printer
.FontName = ContImprim.FontName
.FontBold = ContImprim.FontBold
.FontSize = FacEch * ContImprim.FontSize
.CurrentX = ContImprim.Left * FacEch
.CurrentY = ContImprim.Top * FacEch
End With
Printer.Print ContImprim.Caption
ElseIf TypeOf ContImprim Is TextBox Then
With Printer
.FontName = ContImprim.FontName
.FontBold = ContImprim.FontBold
.FontSize = FacEch * ContImprim.FontSize
.CurrentX = ContImprim.Left * FacEch
.CurrentY = ContImprim.Top * FacEch
End With
Printer.Print ContImprim.Text
ElseIf TypeOf ContImprim Is CheckBox Then
Printer.Line (ContImprim.Left * FacEch, ContImprim.Top * FacEch)-Step(7, 7), , B
If ContImprim.Value = 1 Then
Printer.Line (ContImprim.Left * FacEch, ContImprim.Top * FacEch)-Step(7, 7)
Printer.Line ((ContImprim.Left * FacEch) + 7, ContImprim.Top * FacEch)-Step(-7, 7)
End If
With Printer
.FontName = ContImprim.FontName
.FontBold = ContImprim.FontBold
.FontSize = ContImprim.FontSize * FacEch
.CurrentX = ContImprim.Left * FacEch + 10
.CurrentY = ContImprim.Top * FacEch + 2
End With
Printer.Print ContImprim.Caption
ElseIf TypeOf ContImprim Is MSFlexGrid Then
With Printer
.CurrentX = ContImprim.Left * FacEch
.CurrentY = ContImprim.Top * FacEch
End With
Printer.PaintPicture ContImprim.Picture, Printer.CurrentX, Printer.CurrentY
End If
Next
Printer.Line (Balise(0).X1 * FacEch, Balise(0).Y1 * FacEch)-(Balise(1).X2 * FacEch, Balise(1).Y2 * FacEch), , B
Printer.Line (Balise(0).X1 * FacEch, Balise(0).Y1 * FacEch)-(Balise(2).X2 * FacEch, Balise(2).Y2 * FacEch), , B
Printer.EndDoc
End Sub