Inserting Image in to Header

Microsoft Office excel 2003
August 23, 2010 at 06:52:01
Specs: Windows XP
Hi, it's me again. You knew I'd be back .... sorry

I'm trying to create a macro to inser an image (to be selected for the directory) in to the header, resize, watermak etc. I've come up with the code below. It all works fine, but it also places the image in to the spreadsheet as well as the header but I don't want it on the main page just as a background watermark.

ActiveSheet.PageSetup.LeftHeaderPicture.Application _
.Dialogs(xlDialogInsertPicture).Show


With ActiveSheet.PageSetup.LeftHeaderPicture
.Height = 570
.LockAspectRatio = msoFalse
.Width = 390
.Brightness = 0.85
.ColorType = msoPictureWatermark
.Contrast = 0.15
.CropBottom = 0
.CropLeft = 0
.CropRight = 0
.CropTop = 0

End With

' Enable the image to show up in the left header.
ActiveSheet.PageSetup.LeftHeader = "" & Chr(10) & "" & Chr(10) _
& "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) _
& "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) _
& "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) _
& "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) _
& "" & Chr(10) & "" & Chr(10) & "" & Chr(10) & "" & Chr(10) _
& "" & Chr(10) & "" & Chr(10) & "&G"

End Sub

Any ides?


See More: Inserting Image in to Header

Report •

#1
August 23, 2010 at 07:28:52
OK its stopped working completly now, it doesn't like the height command???

Report •

#2
August 23, 2010 at 07:46:29
re: It all works fine, but it also places the image in to the spreadsheet as well as the header but I don't want it on the main page just as a background watermark.

Well, then it all doesn't work fine!

If you don't want to insert the picture into the document, try using this instead of the InsertPicture dialog box.

Sub myLeftHeader()

'Open the GetOpenFilename dialog box
myHeaderImage = Application.GetOpenFilename

'Use the chosen Filename
    With ActiveSheet.PageSetup.LeftHeaderPicture
        .Filename = myHeaderImage
         etc.
    End With

' Enable the image to show up in the left header.
    ActiveSheet.PageSetup.LeftHeader = your Chr(10)'s & "&G"

End Sub


Report •
Related Solutions


Ask Question