Le fichier à télécharger contient:
Les principales caractéristiques:
Exemple d'une impression en "preview" d'un UserForm pleine page:
- Le Module_PrintUserForm à importer dans le projet VBA.
- Le Module_CopyWindowImageToClipBoa à importer dans le projet VBA.
- Les UserForm1, UserForm2 et UserForm3 de différentes tailles qui donnent des exemples d'impression.
Les principales caractéristiques:
Le Module_PrintUserForm contient:
- La fonction PrintUserForm() qui permet d'imprimer ou 'exporter en PDF un UserForm affiché.
VB:'---------------- 'Print a UserForm '---------------- '- PDFFileFullName: vbNullString or the full name of a PDF file that will contain the printed UserForm '- PaperSize: See https://learn.microsoft.com/en-us/office/vba/api/excel.xlpapersize '- FullPage: True: Size the printed UserForm to the page '- Margins: True: Keep the default page margins '- Preview: True: Show a print preview and do not print or open the PDF file if defined '---------------- Sub PrintUserForm(UserForm As Object, _ Optional PDFFileFullName As String = vbNullString, _ Optional PaperSize As Integer = xlPaperA4, _ Optional FullPage As Boolean = True, _ Optional Margins As Boolean = True, _ Optional Preview As Boolean = True)
Le Module_CopyWindowImageToClipBoa contient:
- La fonction CopyUserFormImageToClipboard() qui permet de copier l'image d'un UserForm dans le presse-papier, évitant l'utilisation d'un <Alt> + PrintScreen qui interfèrerait défavorablement avec un éventuel outil de capture d'écran présent sur le PC.
- La fonction CopyWindowImageToClipboard() qui permet de copier l'image d'une fenêtre quelconque dans le presse-papier.
Exemple d'une impression en "preview" d'un UserForm pleine page: