Probléme Titre Macro

Résolu
scelera Messages postés 40 Statut Membre -  
redaiwa Messages postés 370 Statut Membre -
Bonjour,

J'ai constitué une macro où j'y ai inséré un titre " Extrait de nos références".
Le probléme est quand j'exécute la macro le titre est "Extrait" et le reste à disparu !!
Je vous met la macro .
Pouvez-vous m'aider ?
Please !
Cordialement.

Sub Macro2()
'
' Macro2 Macro
'
' Touche de raccourci du clavier: Ctrl+b
'
Sheets("Feuil1").Select
Columns("G:G").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Feuil2").Select
Columns("A:A").Select
ActiveSheet.Paste
Columns("A:A").EntireColumn.AutoFit
Sheets("Feuil1").Select
Columns("H:H").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Feuil2").Select
Columns("B:B").Select
ActiveSheet.Paste
Columns("B:B").EntireColumn.AutoFit
Sheets("Feuil1").Select
Columns("I:I").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Feuil2").Select
Columns("C:C").Select
ActiveSheet.Paste
Sheets("Feuil1").Select
Columns("J:J").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Feuil2").Select
Columns("D:D").Select
ActiveSheet.Paste
Columns("D:D").EntireColumn.AutoFit
Sheets("Feuil1").Select
Columns("O:O").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Feuil2").Select
Columns("E:E").Select
ActiveSheet.Paste
Sheets("Feuil1").Select
ActiveWindow.SmallScroll ToRight:=18
Columns("AK:AK").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Feuil2").Select
Columns("F:F").Select
ActiveSheet.Paste
Columns("F:F").EntireColumn.AutoFit
Sheets("Feuil1").Select
Columns("AL:AL").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Feuil2").Select
Columns("G:G").Select
ActiveSheet.Paste
Columns("G:G").EntireColumn.AutoFit
Sheets("Feuil1").Select
ActiveWindow.LargeScroll ToRight:=-1
Columns("AH:AH").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Feuil2").Select
Columns("H:H").Select
ActiveSheet.Paste
Sheets("Feuil1").Select
ActiveWindow.LargeScroll ToRight:=1
Columns("AG:AG").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Feuil2").Select
Columns("I:I").Select
ActiveSheet.Paste
Sheets("Feuil1").Select
Columns("K:K").Select
Application.CutCopyMode = False
Selection.Copy
Sheets("Feuil2").Select
Columns("J:J").Select
ActiveSheet.Paste
Sheets("Feuil2").Select
Range("A1:J1").Select
Range("J1").Activate
Application.CutCopyMode = False
Selection.AutoFilter
ActiveWindow.View = xlPageLayoutView
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.7)
.RightMargin = Application.InchesToPoints(0.7)
.TopMargin = Application.InchesToPoints(0.75)
.BottomMargin = Application.InchesToPoints(0.75)
.HeaderMargin = Application.InchesToPoints(0.3)
.FooterMargin = Application.InchesToPoints(0.3)
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.ScaleWithDocHeaderFooter = True
.AlignMarginsHeaderFooter = True
.EvenPage.LeftHeader.Text = ""
.EvenPage.CenterHeader.Text = ""
.EvenPage.RightHeader.Text = ""
.EvenPage.LeftFooter.Text = ""
.EvenPage.CenterFooter.Text = ""
.EvenPage.RightFooter.Text = ""
.FirstPage.LeftHeader.Text = ""
.FirstPage.CenterHeader.Text = ""
.FirstPage.RightHeader.Text = ""
.FirstPage.LeftFooter.Text = ""
.FirstPage.CenterFooter.Text = ""
.FirstPage.RightFooter.Text = ""
End With
Application.PrintCommunication = True
Selection.Font.Bold = True
Selection.Font.Underline = xlUnderlineStyleSingle
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = "&""Arial,Gras""&12&UExtrait de nos références"
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.7)
.RightMargin = Application.InchesToPoints(0.7)
.TopMargin = Application.InchesToPoints(0.75)
.BottomMargin = Application.InchesToPoints(0.75)
.HeaderMargin = Application.InchesToPoints(0.3)
.FooterMargin = Application.InchesToPoints(0.3)
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.ScaleWithDocHeaderFooter = True
.AlignMarginsHeaderFooter = True
.EvenPage.LeftHeader.Text = ""
.EvenPage.CenterHeader.Text = ""
.EvenPage.RightHeader.Text = ""
.EvenPage.LeftFooter.Text = ""
.EvenPage.CenterFooter.Text = ""
.EvenPage.RightFooter.Text = ""
.FirstPage.LeftHeader.Text = ""
.FirstPage.CenterHeader.Text = ""
.FirstPage.RightHeader.Text = ""
.FirstPage.LeftFooter.Text = ""
.FirstPage.CenterFooter.Text = ""
.FirstPage.RightFooter.Text = ""
End With
Application.PrintCommunication = True
Range("F5").Select
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
Application.PrintCommunication = True
ActiveSheet.PageSetup.PrintArea = ""
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = "&""Arial,Gras""&12&UExtrait de nos références"
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(0.75)
.BottomMargin = Application.InchesToPoints(0.75)
.HeaderMargin = Application.InchesToPoints(0.3)
.FooterMargin = Application.InchesToPoints(0.3)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.ScaleWithDocHeaderFooter = True
.AlignMarginsHeaderFooter = True
.EvenPage.LeftHeader.Text = ""
.EvenPage.CenterHeader.Text = ""
.EvenPage.RightHeader.Text = ""
.EvenPage.LeftFooter.Text = ""
.EvenPage.CenterFooter.Text = ""
.EvenPage.RightFooter.Text = ""
.FirstPage.LeftHeader.Text = ""
.FirstPage.CenterHeader.Text = ""
.FirstPage.RightHeader.Text = ""
.FirstPage.LeftFooter.Text = ""
.FirstPage.CenterFooter.Text = ""
.FirstPage.RightFooter.Text = ""
End With
Application.PrintCommunication = True
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
Application.PrintCommunication = True
ActiveSheet.PageSetup.PrintArea = ""
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = "&""Arial,Gras""&12&UExtrait de nos références"
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(0.75)
.BottomMargin = Application.InchesToPoints(0.75)
.HeaderMargin = Application.InchesToPoints(0.3)
.FooterMargin = Application.InchesToPoints(0.3)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.ScaleWithDocHeaderFooter = True
.AlignMarginsHeaderFooter = True
.EvenPage.LeftHeader.Text = ""
.EvenPage.CenterHeader.Text = ""
.EvenPage.RightHeader.Text = ""
.EvenPage.LeftFooter.Text = ""
.EvenPage.CenterFooter.Text = ""
.EvenPage.RightFooter.Text = ""
.FirstPage.LeftHeader.Text = ""
.FirstPage.CenterHeader.Text = ""
.FirstPage.RightHeader.Text = ""
.FirstPage.LeftFooter.Text = ""
.FirstPage.CenterFooter.Text = ""
.FirstPage.RightFooter.Text = ""
End With
Application.PrintCommunication = True
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
Application.PrintCommunication = True
ActiveSheet.PageSetup.PrintArea = ""
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = "&""Arial,Gras""&12&UExtrait de nos références"
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(0.75)
.BottomMargin = Application.InchesToPoints(0.75)
.HeaderMargin = Application.InchesToPoints(0.3)
.FooterMargin = Application.InchesToPoints(0.3)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 0
.FitToPagesTall = 1
.PrintErrors = xlPrintErrorsDisplayed
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.ScaleWithDocHeaderFooter = True
.AlignMarginsHeaderFooter = True
.EvenPage.LeftHeader.Text = ""
.EvenPage.CenterHeader.Text = ""
.EvenPage.RightHeader.Text = ""
.EvenPage.LeftFooter.Text = ""
.EvenPage.CenterFooter.Text = ""
.EvenPage.RightFooter.Text = ""
.FirstPage.LeftHeader.Text = ""
.FirstPage.CenterHeader.Text = ""
.FirstPage.RightHeader.Text = ""
.FirstPage.LeftFooter.Text = ""
.FirstPage.CenterFooter.Text = ""
.FirstPage.RightFooter.Text = ""
End With
Application.PrintCommunication = True
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = "&""Arial,Gras""&20&UExtrait de nos références"
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(0.75)
.BottomMargin = Application.InchesToPoints(0.75)
.HeaderMargin = Application.InchesToPoints(0.3)
.FooterMargin = Application.InchesToPoints(0.3)
.Zoom = 57
.PrintErrors = xlPrintErrorsDisplayed
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.ScaleWithDocHeaderFooter = True
.AlignMarginsHeaderFooter = True
.EvenPage.LeftHeader.Text = ""
.EvenPage.CenterHeader.Text = ""
.EvenPage.RightHeader.Text = ""
.EvenPage.LeftFooter.Text = ""
.EvenPage.CenterFooter.Text = ""
.EvenPage.RightFooter.Text = ""
.FirstPage.LeftHeader.Text = ""
.FirstPage.CenterHeader.Text = ""
.FirstPage.RightHeader.Text = ""
.FirstPage.LeftFooter.Text = ""
.FirstPage.CenterFooter.Text = ""
.FirstPage.RightFooter.Text = ""
End With
Application.PrintCommunication = True
Range("G3").Select
End Sub

5 réponses

  1. WeaponEDGE
     
    Bonjour,

    J'ai testé ta macro pour ma part le titre apparait en entier.
    J'ai tenté de dégrossir le code.
    Essayes la macro ci-dessous et dis moi si tu obtiens le même résultat.

    Sub Macro_Dégrossie()
    Sheets("Feuil1").Select
    Range("G:J,O:O,AK:AL").Select
    Selection.Copy
    Sheets("Feuil2").Select
    ActiveSheet.Paste
    Range("A:B,D:D,F:G").Select
    Selection.EntireColumn.AutoFit
    Sheets("Feuil1").Select
    Columns("AH:AH").Select
    Selection.Copy
    Sheets("Feuil2").Select
    Columns("H:H").Select
    ActiveSheet.Paste
    Sheets("Feuil1").Select
    Columns("AG:AG").Select
    Selection.Copy
    Sheets("Feuil2").Select
    Columns("I:I").Select
    ActiveSheet.Paste
    Sheets("Feuil1").Select
    Columns("K:K").Select
    Selection.Copy
    Sheets("Feuil2").Select
    Columns("J:J").Select
    ActiveSheet.Paste
    Rows(1).Select
    Selection.AutoFilter
    ActiveWindow.View = xlPageLayoutView
    With ActiveSheet.PageSetup
    .LeftHeader = ""
    .CenterHeader = "&""Arial,Gras""&20&UExtrait de nos références"
    .RightHeader = ""
    .LeftFooter = ""
    .CenterFooter = ""
    .RightFooter = ""
    .LeftMargin = Application.InchesToPoints(0.25)
    .RightMargin = Application.InchesToPoints(0.25)
    .TopMargin = Application.InchesToPoints(0.75)
    .BottomMargin = Application.InchesToPoints(0.75)
    .HeaderMargin = Application.InchesToPoints(0.3)
    .FooterMargin = Application.InchesToPoints(0.3)
    .PrintHeadings = False
    .PrintGridlines = False
    .PrintComments = xlPrintNoComments
    .PrintQuality = 600
    .CenterHorizontally = False
    .CenterVertically = False
    .Orientation = xlLandscape
    .Draft = False
    .PaperSize = xlPaperA4
    .FirstPageNumber = xlAutomatic
    .Order = xlDownThenOver
    .BlackAndWhite = False
    .Zoom = 57
    .PrintErrors = xlPrintErrorsDisplayed
    .OddAndEvenPagesHeaderFooter = False
    .DifferentFirstPageHeaderFooter = False
    .ScaleWithDocHeaderFooter = True
    .AlignMarginsHeaderFooter = True
    .EvenPage.LeftHeader.Text = ""
    .EvenPage.CenterHeader.Text = ""
    .EvenPage.RightHeader.Text = ""
    .EvenPage.LeftFooter.Text = ""
    .EvenPage.CenterFooter.Text = ""
    .EvenPage.RightFooter.Text = ""
    .FirstPage.LeftHeader.Text = ""
    .FirstPage.CenterHeader.Text = ""
    .FirstPage.RightHeader.Text = ""
    .FirstPage.LeftFooter.Text = ""
    .FirstPage.CenterFooter.Text = ""
    .FirstPage.RightFooter.Text = ""
    End With
    Range("G3").Select
    End Sub

    WeaponEDGE
    2
    1. scelera Messages postés 40 Statut Membre
       
      Bon mon petit WeaponEDGE je dois une faire chandelle là, tu me résous mes problémes deux fois en deux jours !
      Merci t'assure et bonne journée ;)
      0
    2. WeaponEDGE
       
      No problemo, le forum est là pour ça. ;-)
      0
    3. redaiwa Messages postés 370 Statut Membre 119
       
      Salam tout le monde.

      Le problème était donc au niveau de Application.PrintCommunication ? Je m'en doutais un peu.
      0
  2. gbinforme Messages postés 14930 Date d'inscription   Statut Contributeur Dernière intervention   4 744
     
    Bonjour,

    Si tu pouvais nous mettre un exemple sans éléments personnels mais avec la structure des données et ta macro sur https://www.cjoint.com/ puis nous mettre le lien généré ici ce serait plus facile de t'aider car ta liste est assez imbuvable...
    0
  3. rEVOLV3r Messages postés 223 Date d'inscription   Statut Membre Dernière intervention   28
     
    Bonjour,

    C'est vrai qu'elle fait mal aux yeux cette macro..
    Cependant quelque chose me semble bizarre à cette ligne de code :

    .CenterHeader = "&""Arial,Gras""&12&UExtrait de nos références"

    Si tu changais le U par ", peut-être que ca pourrait aller mieux, peut-être.

    Amicalement,
    rEVOLV3r
    0
    1. scelera Messages postés 40 Statut Membre
       
      Merci pour ton aide mais ta solutuion ne fonctionne pas.
      WeaponEDGE a trouvé la solution ;)
      Merci guys !!
      0
  4. redaiwa Messages postés 370 Statut Membre 119
     
    Salam tout le monde.

    La ligne .CenterHeader = "&""Arial,Gras""&12&UExtrait de nos références" marche bien chez moi. C'est la commande Application.PrintCommunication qui n'est pas reconnue ??? Elle sert à quoi?
    0
    1. WeaponEDGE
       
      Je ne sais pas mais vu que son code est tiré de l'enregistreur de Macro il y a plein de termes qui ne servent à rien et surtout il y plein de doublons.
      0
  5. Vous n’avez pas trouvé la réponse que vous recherchez ?

    Posez votre question
  6. rEVOLV3r Messages postés 223 Date d'inscription   Statut Membre Dernière intervention   28
     
    Selon Microsoft :

    <<Specifies whether communication with the printer is turned on. Boolean Read/write>>

    Donc c'est un indicateur booléen qui va dire si la communication avec l'imprimante est activée ou pas.
    0