Inserting pictures in the header? :(

jayson26

Board Regular
Joined
Aug 26, 2002
Messages
78
I'm having trouble getting pictures to print right when I insert them in the header.

For example, if the size of the original picture is too large, it gets cropped, AND it doesn't print all the way to the margin edges.

Any tips??

:banghead:

Thanks!
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
The following example comes straight out of the VBA Help file (Excel XP). Adjust the path and file name, and the other variables to suit.

Put the macro into a standard module.
Code:
Sub InsertPicture()

    With ActiveSheet.PageSetup.LeftHeaderPicture
        .Filename = "C:\Temp\logo.jpg"
        .Height = 100
        .Width = 150
        .Brightness = 0.36
        .ColorType = msoPictureAutomatic
        .Contrast = 0.39
        .CropBottom = 0
        .CropLeft = 0
        .CropRight = 0
        .CropTop = 0
    End With

    ' Enable the image to show up in the left header.
    ActiveSheet.PageSetup.LeftHeader = "&G"

End Sub
Notes:
It is required that "&G" is a part of the LeftHeader string in order for the image to show up in the left header.

MsoPictureColorType can be one of these MsoPictureColorType constants.

msoPictureAutomatic (colour)
msoPictureBlackAndWhite
msoPictureGrayscale
msoPictureMixed
msoPictureWatermark

HTH

Mike
 
Upvote 0
ekim,
thanks.

The problem doesn't go away though: why can't I make the picture print all the way to the margin?

:(
 
Upvote 0
Works OK for me, providing I stick to the default margins.

Scrap the macro and try this:

Insert your image directly on the worksheet -

Insert menu | Picture | From File ....
Select your picture
Then click “Insert”

Click the picture and drag it to cell A1.

If you want the picture on every page, then
File menu | Page Setup | Sheets | Rows to repeat at top.

With this method, it does not matter if you adjust the margins. The picture snaps to the intersection of the left and top margin.

Another method is to use Word to print the header and then run the paper through the printer again when you print from excel.

Note:
Avoid resizing a picture/image on a worksheet by dragging the picture’s borders. Invariably, you end up distorting the picture’s resolution. The best way is to use a photo editor to do the resizing, colour contrast, brightness, cropping etc. Save the picture then import the finished product into Excel.

HTH

Mike
 
Upvote 0
Thanks!!

Your suggestion worked! :)

I need to bug you with one more question: is there a way to print a picture behind text, somewhere in the middle of the sheet?
 
Upvote 0
As Kristy stated, you are referring to a watermark. You can put a watermark on your sheet programmatically, but as an alternative see if your printer can do watermarks.

This is what I do when I want a watermark (using an Epson Stylus):

Excel’s File menu | Page Setup.
In the Page Setup dialog box, click the button named “Options…” - this accesses the printer’s Property dialog box.
Click the tab “Page Layout” (or something similar with your printer).
Click the Watermark’s drop down menu and select an option (“Draft”, “Priority”, Urgent” etc.). If I don’t like any of the options, there is a facility to import my own.
Click the “Settings” button – select the watermark’s colour, position (center, top right etc.), intensity, and size.

That’s it, very simple. It takes about 10 seconds to set up.

Regards,

Mike
 
Upvote 0

Forum statistics

Threads
1,225,073
Messages
6,182,700
Members
453,132
Latest member
nsnodgrass73

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top