barre de progression impression mise en page

  • Initiateur de la discussion Initiateur de la discussion steph.777
  • Date de début Date de début

Boostez vos compétences Excel avec notre communauté !

Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !

steph.777

XLDnaute Nouveau
bonjour le forum

je comprend pas ce code qui fonctionnait , s'arrete a MAINTENANT 33%

ERREUR 1004 La methode select de woorksheet a echoué

merci pour votre aide stephane
stephane



Sub Noir_et_blanc()

Application.ScreenUpdating = False

Dim iWsh As Integer
Dim oWsh As Worksheet
Dim PctDone As Single

iWsh = ThisWorkbook.Worksheets.Count

For Each oWsh In ThisWorkbook.Worksheets

PctDone = oWsh.Index / iWsh

With userfbarrenoir
.FrameProgress.Caption = Format(PctDone, "0%")
.LabelProgress.Width = PctDone * (.FrameProgress.Width - 10)
End With

' The DoEvents statement is responsible for the form updating
DoEvents
oWsh.Select😕bloque la
ActiveSheet.PageSetup.PrintArea = "$A$1:$W$55"
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0)
.RightMargin = Application.InchesToPoints(0)
.TopMargin = Application.InchesToPoints(0)
.BottomMargin = Application.InchesToPoints(0)
.HeaderMargin = Application.InchesToPoints(0)
.FooterMargin = Application.InchesToPoints(0)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = -3
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = True
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = True
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
'apercu
'ActiveWindow.SelectedSheets.PrintPreview

Next oWsh

Application.ScreenUpdating = True

Unload userfbarrenoir

End Sub
 
Re : barre de progression impression mise en page

Re bonjour Steph

J'ai un peu modifié la macro.

Celle-ci ne sélectionne plus les feuilles, les opérations sont donc transparentes pour l'utilisateur. Mais si c'est absolument nécessaire tu peux facilement répablir les choses.

Code:
Sub Noir_et_blanc()
    Application.ScreenUpdating = False
    Dim iWsh As Integer
    Dim oWsh As Worksheet
    Dim PctDone As Single
   [COLOR=red]Dim i As Integer[/COLOR]
    iWsh = ThisWorkbook.Worksheets.Count
   [COLOR=red]For i = 12 To iwhs[/COLOR]
        [COLOR=red]Set oWsh = Worksheets(i)[/COLOR]
[COLOR=red]       PctDone = i / (iWsh - 11)[/COLOR]
        With userfbarrenoir
            .FrameProgress.Caption = Format(PctDone, "0%")
            .LabelProgress.Width = PctDone * (.FrameProgress.Width - 10)
        End With
        ' The DoEvents statement is responsible for the form updating
        DoEvents
        [COLOR=red]With oWsh[/COLOR]
            .PageSetup.PrintArea = "$A$1:$W$55"
            [COLOR=red]With .PageSetup[/COLOR]
                .LeftHeader = ""
                .CenterHeader = ""
                .RightHeader = ""
                .LeftFooter = ""
                .CenterFooter = ""
                .RightFooter = ""
                .LeftMargin = Application.InchesToPoints(0)
                .RightMargin = Application.InchesToPoints(0)
                .TopMargin = Application.InchesToPoints(0)
                .BottomMargin = Application.InchesToPoints(0)
                .HeaderMargin = Application.InchesToPoints(0)
                .FooterMargin = Application.InchesToPoints(0)
                .PrintHeadings = False
                .PrintGridlines = False
                .PrintComments = xlPrintNoComments
                .PrintQuality = -3
                .CenterHorizontally = False
                .CenterVertically = False
                .Orientation = xlLandscape
                .Draft = True
                .PaperSize = xlPaperA4
                .FirstPageNumber = xlAutomatic
                .Order = xlDownThenOver
                .BlackAndWhite = True
                .Zoom = False
                .FitToPagesWide = 1
                .FitToPagesTall = 1
            End With [COLOR=red]'PageSetUp[/COLOR]
        [COLOR=red]End With 'oWsh[/COLOR]
        'apercu
        [COLOR=red]'oWhs.PrintPreview[/COLOR]
    Next i
    Application.ScreenUpdating = True
    Unload userfbarrenoir
End Sub

A bientôt
 
- Navigue sans publicité
- Accède à Cléa, notre assistante IA experte Excel... et pas que...
- Profite de fonctionnalités exclusives
Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel.
Je deviens Supporter XLD

Discussions similaires

Réponses
7
Affichages
168
Réponses
0
Affichages
1 K
Retour