Ceci est une page optimisée pour les mobiles. Cliquez sur ce texte pour afficher la vraie page.

Macros ne fonctinne pas ???

  • Initiateur de la discussion Initiateur de la discussion veloce
  • 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 !

V

veloce

Guest
Pouvez-vous me dire pourquoi

ActiveWindow.SelectedSheets.PrintPreview
Worksheet = Workbook.Worksheets("Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre").Select
With ActiveWorksheets.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.787401575)
.RightMargin = Application.InchesToPoints(0.787401575)
.TopMargin = Application.InchesToPoints(0.384251969)
.BottomMargin = Application.InchesToPoints(0.384251969)
.HeaderMargin = Application.InchesToPoints(0.3121259845)
.FooterMargin = Application.InchesToPoints(0.3121259845)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 300
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
End With
 
Re : Macros ne fonctinne pas ???

Salut,

Trés drole... lol

Donnes tout de même plus d'information, il y a des champions sur ce site, mais là, si ils arrivent à répondre, je me convertis. lol

Ou est-ce que ça plante ?
Tu fais une preview de la page active avant de définir les pages des mois, l'interet ?

Cette extrait fait partit d'un plus grand projet, qu'en est-il ?

...
 
Re : Macros ne fonctinne pas ???

Bonjour

Code:
Worksheet = Workbook.Worksheet( "Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre").Select
With ActiveWorksheets.PageSetup

devient :

Code:
With Sheets(Array("Janvier", "Février", "Mars", "Avril","Mai"))
 
Re : Macros ne fonctinne pas ???

Re Bonjour wilfried,
Voilà ce que je recherche, mais la cela me met que le mois de janvier ??



With Sheets(Array("Janvier", "Février", "Mars", "Avril")).Select
End With

With ActiveSheet.PageSetup

.LeftMargin = Application.InchesToPoints(0.590551181102362)
.RightMargin = Application.InchesToPoints(0.590551181102362)
.TopMargin = Application.InchesToPoints(0.590551181102362)
.BottomMargin = Application.InchesToPoints(0.590551181102362)
.HeaderMargin = Application.InchesToPoints(0.31496062992126)
.FooterMargin = Application.InchesToPoints(0.31496062992126)
.PrintQuality = 300
.Orientation = xlLandscape
.Order = xlDownThenOver

End With
 
Re : Macros ne fonctinne pas ???

re:

Code:
With Sheets(Array("Janvier", "Février", "Mars", "Avril")).PageSetup

.LeftMargin = Application.InchesToPoints(0.590551181102362)
.RightMargin = Application.InchesToPoints(0.590551181102362)
.TopMargin = Application.InchesToPoints(0.590551181102362)
.BottomMargin = Application.InchesToPoints(0.590551181102362)
.HeaderMargin = Application.InchesToPoints(0.31496062992126)
.FooterMargin = Application.InchesToPoints(0.31496062992126)
.PrintQuality = 300
.Orientation = xlLandscape
.Order = xlDownThenOver

End With

Comme cela,
 
Re : Macros ne fonctinne pas ???

Bonsoir


Trouvé chez nos amis d'outre-atantique

Code:
[COLOR=blue]Option Explicit[/COLOR] 
[COLOR=blue]Sub[/COLOR] SetupAllSheets() 
     [COLOR=darkgreen]'[/COLOR]
    [COLOR=blue]Dim[/COLOR] M [COLOR=blue]As[/COLOR] [COLOR=blue]Long[/COLOR], N [COLOR=blue]As[/COLOR] [COLOR=blue]Long[/COLOR], Firstsht [COLOR=blue]As[/COLOR] [COLOR=blue]Long[/COLOR], Lastsht [COLOR=blue]As[/COLOR] [COLOR=blue]Long[/COLOR], Sheet [COLOR=blue]As[/COLOR] [COLOR=blue]Object[/COLOR] 
     [COLOR=darkgreen]'[/COLOR]
    Lastsht = Sheets.Count 
    M = 0: N = Lastsht 
     [COLOR=darkgreen]'[/COLOR]
    [COLOR=blue]For Each[/COLOR] Sheet [COLOR=blue]In[/COLOR] Sheets 
        [COLOR=blue]If[/COLOR] [COLOR=blue]Not[/COLOR] Sheet.Visible [COLOR=blue]Then[/COLOR] N = N - 1 
        [COLOR=blue]If[/COLOR] Sheet.Visible [COLOR=blue]And[/COLOR] Sheet.Type = xlWorksheet [COLOR=blue]Then[/COLOR] 
            [COLOR=blue]If[/COLOR] WorksheetFunction.CountA(Sheet.UsedRange) = 0 [COLOR=blue]Then[/COLOR] 
                N = N - 1 
            [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR] 
        [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR] 
    [COLOR=blue]Next[/COLOR] 
     [COLOR=darkgreen]'[/COLOR]
    [COLOR=blue]For[/COLOR] Firstsht = 1 [COLOR=blue]To[/COLOR] Lastsht 
         [COLOR=darkgreen]'[/COLOR]
        [COLOR=blue]If[/COLOR] Sheets(Firstsht).Visible = [COLOR=blue]True[/COLOR] [COLOR=blue]Then[/COLOR] 
             [COLOR=darkgreen]'[/COLOR]
            [COLOR=blue]If[/COLOR] [COLOR=blue]Not[/COLOR] TypeName(Sheets(Firstsht)) = "Chart" [COLOR=blue]Then[/COLOR] 
                [COLOR=blue]If[/COLOR] WorksheetFunction.CountA(Sheets(Firstsht).UsedRange) <> 0 [COLOR=blue]Then[/COLOR] 
                    M = M + 1 
                    GoSub DoPrint 
                [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR] 
            [COLOR=blue]Else[/COLOR] [COLOR=darkgreen]'else it's a chart[/COLOR]
                M = M + 1 
                GoSub DoPrint 
            [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR] 
             [COLOR=darkgreen]'[/COLOR]
        [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR] 
         [COLOR=darkgreen]'[/COLOR]
    [COLOR=blue]Next[/COLOR] [COLOR=darkgreen]'Firstsht[/COLOR]
    Exit [COLOR=blue]Sub[/COLOR] 
DoPrint: 
    [COLOR=blue]With[/COLOR] Sheets(Firstsht).PageSetup 
        .LeftHeader = "" 
        .CenterHeader = "" 
        .RightHeader = "" 
        .LeftFooter = "" 
        .CenterFooter = "" 
        .RightFooter = "" 
        .LeftMargin = Application.InchesToPoints(0.15748031496063) 
        .RightMargin = Application.InchesToPoints(0.15748031496063) 
        .TopMargin = Application.InchesToPoints(0.78740157480315) 
        .BottomMargin = Application.InchesToPoints(0.78740157480315) 
        .HeaderMargin = Application.InchesToPoints(0.31496062992126) 
        .FooterMargin = Application.InchesToPoints(0.31496062992126) 
        .PrintHeadings = [COLOR=blue]False[/COLOR] 
        .PrintGridlines = [COLOR=blue]False[/COLOR] 
        .PrintComments = xlPrintNoComments 
        .PrintQuality = 600 
        .CenterHorizontally = [COLOR=blue]False[/COLOR] 
        .CenterVertically = [COLOR=blue]False[/COLOR] 
        .Orientation = xlLandscape 
        .Draft = [COLOR=blue]False[/COLOR] 
        .PaperSize = xlPaperA4 
        .FirstPageNumber = xlAutomatic 
        .Order = xlDownThenOver 
        .BlackAndWhite = [COLOR=blue]False[/COLOR] 
        .Zoom = [COLOR=blue]False[/COLOR] 
        .FitToPagesWide = 1 
        .FitToPagesTall = [COLOR=blue]False[/COLOR] 
        .PrintErrors = xlPrintErrorsDisplayed 
    [COLOR=blue]End With[/COLOR] 
    [COLOR=blue]With[/COLOR] Application 
        .EnableEvents = [COLOR=blue]False[/COLOR] 
         [COLOR=darkgreen]'        Sheets(Firstsht).PrintPreview '.PrintOut[/COLOR]
        .EnableEvents = [COLOR=blue]True[/COLOR] 
    [COLOR=blue]End With[/COLOR] 
Return 
[COLOR=blue]End Sub
[/COLOR]
 
Re : Macros ne fonctinne pas ???

RE,
Trouver cela en plus rapide, mais plus lourd

Sub Macro1()
'
' Macro1 Macro
' Macro enregistrée le 29/01/2008 par J.R
'

'

Sheets("Janvier").Select
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup

.LeftMargin = Application.InchesToPoints(0.787401575)
.RightMargin = Application.InchesToPoints(0.787401575)
.TopMargin = Application.InchesToPoints(0.604251969)
.BottomMargin = Application.InchesToPoints(0.604251969)
.HeaderMargin = Application.InchesToPoints(0.4921259845)
.FooterMargin = Application.InchesToPoints(0.4921259845)
.PrintQuality = 300
.Orientation = xlLandscape
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.FitToPagesWide = 1
.FitToPagesTall = 1
End With


Sheets("Février").Select
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup

.LeftMargin = Application.InchesToPoints(0.787401575)
.RightMargin = Application.InchesToPoints(0.787401575)
.TopMargin = Application.InchesToPoints(0.984251969)
.BottomMargin = Application.InchesToPoints(0.984251969)
.HeaderMargin = Application.InchesToPoints(0.4921259845)
.FooterMargin = Application.InchesToPoints(0.4921259845)
.PrintQuality = 300
.Orientation = xlLandscape
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.FitToPagesWide = 1
.FitToPagesTall = 1
End With

Sheets("Mars").Select
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup

.LeftMargin = Application.InchesToPoints(0.787401575)
.RightMargin = Application.InchesToPoints(0.787401575)
.TopMargin = Application.InchesToPoints(0.604251969)
.BottomMargin = Application.InchesToPoints(0.604251969)
.HeaderMargin = Application.InchesToPoints(0.4921259845)
.FooterMargin = Application.InchesToPoints(0.4921259845)
.PrintQuality = 300
.Orientation = xlLandscape
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.FitToPagesWide = 1
.FitToPagesTall = 1
End With

End Sub
 
- 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
Assurez vous de marquer un message comme solution pour une meilleure transparence.

Discussions similaires

Réponses
7
Affichages
367
J
Réponses
6
Affichages
3 K
P
Réponses
6
Affichages
1 K
Pieerre69
P
M
  • Question Question
Réponses
0
Affichages
1 K
Mirguy23
M
Réponses
5
Affichages
1 K
C
Réponses
5
Affichages
2 K
C
Les cookies sont requis pour utiliser ce site. Vous devez les accepter pour continuer à utiliser le site. En savoir plus…