Macro pour ajouter / supprimer entête et pied de page

bonjour

je souhaite développer une macro pour que l'entête d'une feuille se modifie en fonction du choix d'un formulaire

pour l'instant j'essaie juste de faire la macro pour coller une image dans l'entête mais rien ne s'affiche

ci-dessous le code utilisé :

avez vous explication svp ?

Sub entete()

'

' entete Macro

'

'

ActiveSheet.PageSetup.LeftHeaderPicture.Filename = _

"Z:\My Documents\logo\logo Worms SM.JPG"

Application.PrintCommunication = False

With ActiveSheet.PageSetup

.PrintTitleRows = ""

.PrintTitleColumns = ""

End With

Application.PrintCommunication = True

ActiveSheet.PageSetup.PrintArea = "$A$10:$H$70"

Application.PrintCommunication = False

With ActiveSheet.PageSetup

.LeftHeader = "&G"

.CenterHeader = ""

.RightHeader = ""

.LeftFooter = ""

.CenterFooter = ""

.RightFooter = ""

.LeftMargin = Application.InchesToPoints(0.393700787401575)

.RightMargin = Application.InchesToPoints(0.393700787401575)

.TopMargin = Application.InchesToPoints(0.196850393700787)

.BottomMargin = Application.InchesToPoints(0.196850393700787)

.HeaderMargin = Application.InchesToPoints(0)

.FooterMargin = Application.InchesToPoints(0)

.PrintHeadings = False

.PrintGridlines = False

.PrintComments = xlPrintSheetEnd

.PrintQuality = 1200

.CenterHorizontally = True

.CenterVertically = True

.Orientation = xlPortrait

.Draft = False

.PaperSize = xlPaperA4

.FirstPageNumber = xlAutomatic

.Order = xlDownThenOver

.BlackAndWhite = False

.Zoom = 100

.PrintErrors = xlPrintErrorsDisplayed

.OddAndEvenPagesHeaderFooter = False

.DifferentFirstPageHeaderFooter = False

.ScaleWithDocHeaderFooter = False

.AlignMarginsHeaderFooter = False

.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

End Sub

merci

seb

Bonjour,

Un test préliminaire démontre que ton code fonctionne.

Si l'image ne s'affiche pas :

  • le chemin ou le nom ne sont peut-être pas exacts, incluant les minus et majus.
  • la taille est peut-être trop grande.

Gelinotte

bonjour

merci. je vais refaire un test sur un autre ordi.

te tiens informé

Bonjour

tu avais raison, ça marche chez moi.

je pense qu'au bureau il y a avit prob a cause du fait d'etre sur réseau

merci beaucoup

seb

Rechercher des sujets similaires à "macro ajouter supprimer entete pied page"