With tondocument.PageSetup .LeftMargin = Application.InchesToPoints(0) .RightMargin = Application.InchesToPoints(0) .TopMargin = Application.InchesToPoints(0) .BottomMargin = Application.InchesToPoints(0) End With
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionOption Compare Database Option Explicit ' *** Début du module Impression *** Type ch_PRTMIP chRGB As String * 28 End Type Type type_PRTMIP entMargeGauche As Long entMargeHaut As Long entMargeDroite As Long entMargeBas As Long End Type Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long Public Sub ModifierMarges(txtNom As String, lngHaut As Long, lngBas As Long, lngGauche As Long, lngDroite As Long) ' Modifier les marges d'un rapport avant de l'imprimer ' paramètres : 1- le nom du rapport en texte ' 2- la marge du haut en cm ' 3- la marge du bas en cm ' 4- la marge du gauche en cm ' 5- la marge du droite en cm ' exemple : ModifierMarges "Contacts", 1, 1, 1.5, 1.5 ' DoCmd.OpenReport "Contacts", acViewPreview Dim ChaînePrtMip As ch_PRTMIP Dim PM As type_PRTMIP Dim rpt As Report DoCmd.OpenReport txtNom, acDesign ' Ouvre l'état en mode Création. Set rpt = Reports(txtNom) ChaînePrtMip.chRGB = rpt.PrtMip LSet PM = ChaînePrtMip PM.entMargeHaut = lngHaut * 567 ' Définit les marges. PM.entMargeBas = lngBas * 567 PM.entMargeGauche = lngGauche * 567 PM.entMargeDroite = lngDroite * 567 LSet ChaînePrtMip = PM ' Met à jour la propriété. rpt.PrtMip = ChaînePrtMip.chRGB DoCmd.Save End Sub