joliemaman007
XLDnaute Nouveau
Bonjour tout le monde.
je suis tres dubitative ... si si.
je fais (je pense) une macro super simple:
imprimer une zone fixe, d'une feuille fixe (toujours le meme nom, toujours la meme zone); seule obligation: c'est que l'impression se fasse sur une seule page. ca fonctionne, certe, mais ca met plus de 30 secondes !!! (alors que si j'appuie betement sur le bouton d'impression, c'est 30 fois plus rapide). Ou est le bug ? siouplé ohhh maitres et maitresses des codes encore méconnus de ma petite tete ....
________________
Voici mon code:
a noter:
la valeur de NomDeLaFeuille est 'Form1C'
Sub Imprime_Enregistrement(NomDeLaFeuille As String)
'
' Imprime_Enregistrement Macro
' Macro recorded 22-11-2005 by Joliemaman007
'
'
' Verifier qu'il y a quelque chose à imprimer (donc que ID est rentré
' Pour le moment l'impression ne se fait que sur l'intercalaire Form1C
' donc se deplacer dessus. Par la suite, on pourra faire un loop sur plusieurs
' formulaires a imprimer.
' blocage du mouvement sur l'ecran
Application.ScreenUpdating = False
Application.EnableEvents = False
'sortie de loop si pas de ID car cela veut dire qu'il n'y a rien à imprimer
If NomDeLaFeuille = 'Form1C' And Range('item_id').Value = '' Then GoTo suite
'déprotege
With Worksheets(NomDeLaFeuille)
.Unprotect
End With
'definit le page setup
With Worksheets(NomDeLaFeuille).PageSetup
.PrintTitleRows = ''
.PrintTitleColumns = ''
.LeftHeader = ''
.CenterHeader = ''
.RightHeader = ''
.LeftFooter = '&BXCRED Confidential&B'
.CenterFooter = '&D'
.RightFooter = 'Page &P'
.LeftMargin = Application.InchesToPoints(0.275590551181102)
.RightMargin = Application.InchesToPoints(0.275590551181102)
.TopMargin = Application.InchesToPoints(0.31496062992126)
.BottomMargin = Application.InchesToPoints(0.31496062992126)
.HeaderMargin = Application.InchesToPoints(0.511811023622047)
.FooterMargin = Application.InchesToPoints(0.196850393700787)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = True
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
.PrintErrors = xlPrintErrorsDisplayed
End With
'si on imprime, d'abord effacer les zone de calcul de numerotation
With Worksheets(NomDeLaFeuille)
ActiveSheet.Range('G6').Range('A1').Select
Selection.ClearContents
End With
Worksheets(NomDeLaFeuille).PageSetup.PrintArea = '$A$5:$AL$91'
With Worksheets(NomDeLaFeuille)
.PrintOut
End With
'Reprotege
With Worksheets(NomDeLaFeuille)
.Protect
End With
suite:
Application.EnableEvents = True
Application.ScreenUpdating = True
If NomDeLaFeuille = 'Form1C' And Range('item_id').Value = '' Then MsgBox ('NOTHING TO PRINT / RIEN A IMPRIMER;' & Chr(13) & 'Select one form from the drop down menu' & Chr(13) & 'in the yellow square')
End Sub
:ermm:
joliemaman007
ps: je n'attache pas le fichier car je suis dans l'incapacité de le zipper a 50k max ....
je suis tres dubitative ... si si.
je fais (je pense) une macro super simple:
imprimer une zone fixe, d'une feuille fixe (toujours le meme nom, toujours la meme zone); seule obligation: c'est que l'impression se fasse sur une seule page. ca fonctionne, certe, mais ca met plus de 30 secondes !!! (alors que si j'appuie betement sur le bouton d'impression, c'est 30 fois plus rapide). Ou est le bug ? siouplé ohhh maitres et maitresses des codes encore méconnus de ma petite tete ....
________________
Voici mon code:
a noter:
la valeur de NomDeLaFeuille est 'Form1C'
Sub Imprime_Enregistrement(NomDeLaFeuille As String)
'
' Imprime_Enregistrement Macro
' Macro recorded 22-11-2005 by Joliemaman007
'
'
' Verifier qu'il y a quelque chose à imprimer (donc que ID est rentré
' Pour le moment l'impression ne se fait que sur l'intercalaire Form1C
' donc se deplacer dessus. Par la suite, on pourra faire un loop sur plusieurs
' formulaires a imprimer.
' blocage du mouvement sur l'ecran
Application.ScreenUpdating = False
Application.EnableEvents = False
'sortie de loop si pas de ID car cela veut dire qu'il n'y a rien à imprimer
If NomDeLaFeuille = 'Form1C' And Range('item_id').Value = '' Then GoTo suite
'déprotege
With Worksheets(NomDeLaFeuille)
.Unprotect
End With
'definit le page setup
With Worksheets(NomDeLaFeuille).PageSetup
.PrintTitleRows = ''
.PrintTitleColumns = ''
.LeftHeader = ''
.CenterHeader = ''
.RightHeader = ''
.LeftFooter = '&BXCRED Confidential&B'
.CenterFooter = '&D'
.RightFooter = 'Page &P'
.LeftMargin = Application.InchesToPoints(0.275590551181102)
.RightMargin = Application.InchesToPoints(0.275590551181102)
.TopMargin = Application.InchesToPoints(0.31496062992126)
.BottomMargin = Application.InchesToPoints(0.31496062992126)
.HeaderMargin = Application.InchesToPoints(0.511811023622047)
.FooterMargin = Application.InchesToPoints(0.196850393700787)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = True
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
.PrintErrors = xlPrintErrorsDisplayed
End With
'si on imprime, d'abord effacer les zone de calcul de numerotation
With Worksheets(NomDeLaFeuille)
ActiveSheet.Range('G6').Range('A1').Select
Selection.ClearContents
End With
Worksheets(NomDeLaFeuille).PageSetup.PrintArea = '$A$5:$AL$91'
With Worksheets(NomDeLaFeuille)
.PrintOut
End With
'Reprotege
With Worksheets(NomDeLaFeuille)
.Protect
End With
suite:
Application.EnableEvents = True
Application.ScreenUpdating = True
If NomDeLaFeuille = 'Form1C' And Range('item_id').Value = '' Then MsgBox ('NOTHING TO PRINT / RIEN A IMPRIMER;' & Chr(13) & 'Select one form from the drop down menu' & Chr(13) & 'in the yellow square')
End Sub
:ermm:
joliemaman007
ps: je n'attache pas le fichier car je suis dans l'incapacité de le zipper a 50k max ....