PageSetup.RightHeaderPicture property (Excel)

Returns a Graphic object that represents the picture for the right section of the header. Used to set attributes about the picture.

Syntax

expression.RightHeaderPicture

expression A variable that represents a PageSetup object.

Remarks

The RightHeaderPicture property is read-only, but not all of its properties are read-only.

It's required that "&G" be a part of the RightHeader property string for the image to show up in the right header.

Example

The following example adds a picture titled Sample.jpg from the C:\ drive to the right section of the header. This example assumes that a file called Sample.jpg exists on the C:\ drive.

Sub InsertPicture() 
 
 With ActiveSheet.PageSetup.RightHeaderPicture 
 .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 right header. 
 ActiveSheet.PageSetup.RightHeader = "&G" 
 
End Sub

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.