title | keywords | f1_keywords | api_name | ms.assetid | ms.date | ms.localizationpriority | ||
---|---|---|---|---|---|---|---|---|
PageSetup.CenterHeaderPicture property (Excel) |
vbaxl10.chm473106 |
|
|
c4c6e0b5-96e3-eaea-2dfe-807f286029ec |
05/03/2019 |
medium |
Returns a Graphic object that represents the picture for the center section of the header. Used to set attributes about the picture.
expression.CenterHeaderPicture
expression A variable that represents a PageSetup object.
The CenterHeaderPicture property is read-only, but the properties on it are not all read-only.
It's required that "&G"
be a part of the CenterHeader property string for the image to show up in the center header.
The following example adds a picture titled Sample.jpg from the C:\ drive to the center section of the header. This example assumes that a file called Sample.jpg exists on the C:\ drive.
Sub InsertPicture()
With ActiveSheet.PageSetup.CentertHeaderPicture
.FileName = "C:\Sample.jpg"
.Height = 275.25
.Width = 463.5
.Brightness = 0.36
.ColorType = msoPictureGrayscale
.Contrast = 0.39
.CropBottom = -14.4
.CropLeft = -28.8
.CropRight = -14.4
.CropTop = 21.6
End With
' Enable the image to show up in the center header.
ActiveSheet.PageSetup.CenterHeader = "&G"
End Sub
[!includeSupport and feedback]