ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Adding picture to page setup (https://www.excelbanter.com/excel-programming/359571-adding-picture-page-setup.html)

DavidC

Adding picture to page setup
 
Hi,

I want to add a picture to the left hand header in Page setup. So far I
have tried the code that adds a picture to a worksheet but that does not seem
to work.

.LeftHeader = .Shapes.AddPicture("C:\Documents and Settings\My
Documents\Logo.jpeg", False, True, 10, 10, 70, 70)

I note that there does not seem to be a method of manually adding a picture
to the header so my guess is that it is just not possible, but would like
confirmation either that my guess it correct or that there is a way to add a
picture using VBZ.

Regards


DavidC


Pelarian

Adding picture to page setup
 
David,
When I recorded a macro this is the information that I got when I
put a picture in my header on the left side.
I did this by going to viewHeader/Footer - then clicking on custom.
Once I was there I hit the picture icon and let it place it in the
left-hand side of the header.

I hope that this will be of help to you.

Below is the VBA code from the Macro Recorder,
Cheers,
Brian


ActiveSheet.PageSetup.LeftHeaderPicture.Filename = _
"C:\Documents and
Settings\myNameHere\Pictures\deer-1280-1024.jpg"
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = "&G"
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
End With
End Sub


DavidC

Adding picture to page setup
 
Hi, Pelarian,

I should have mentioned that I am running Office 2000. Which version do you
run, as I cannot see any picture Icon under headers, custom, so I suspect
that it is only available in Exell 2003

Regards

DavidC

"Pelarian" wrote:

David,
When I recorded a macro this is the information that I got when I
put a picture in my header on the left side.
I did this by going to viewHeader/Footer - then clicking on custom.
Once I was there I hit the picture icon and let it place it in the
left-hand side of the header.

I hope that this will be of help to you.

Below is the VBA code from the Macro Recorder,
Cheers,
Brian


ActiveSheet.PageSetup.LeftHeaderPicture.Filename = _
"C:\Documents and
Settings\myNameHere\Pictures\deer-1280-1024.jpg"
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = "&G"
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
End With
End Sub



Pelarian

Adding picture to page setup
 
Sorry it took me so long to reply to you. I am running Office 2k3 both
at work and at home. so yes I can see this could be an issue.
I did a little research on Google and found this information at
http://www.exceltip.com/st/Adding_a_...ooter/202.html
A really good place to look around and ask for assistance. I have also
read one of their books and found their information on VBA in Excel
invaluable. Below you will find an excert from the web page that I
listed above. Also here is the text that I typed in to google.com to
search for information on your question..."add a picture to Excel 2000
header". Hopefully this will help you out a little more that what I
gave you before.

{Quoted from ExcelTip.com}
To add a picture (such as a company logo) to the header/ footer in
Excel 97 and Excel 2000:

1. Select cell A1.
2. From the Insert menu, select Picture, and then select From File.
3. Select the picture you want, and click Insert.
4. Adjust the picture to the height and width of the row.
5. From the File menu, select Page Setup.
6. Select the Sheet tab.
7. Select Rows to repeat at top.
8. Select row 1, and then click OK.

While doing these steps you should be able to AFTER doing them a time
or three <grin be able to turn the macro recorder on and then after
doing the steps be able to get the code from there.

Feel free to send me an email (please look at my profile to retrieve
the email address)

Regards,
Pelarian


DavidC

Adding picture to page setup
 
Hi,

Thanks for your help. I too found the references, and they are a work
around. Basically it is using the ability to reproduce the first defined
rows on each sheet. It is a form of header and will do the job. It does
appear that the ability to ad a picture into the header itself is only
available in versions later than 2000.

Regards

David

"DavidC" wrote:

Hi,

I want to add a picture to the left hand header in Page setup. So far I
have tried the code that adds a picture to a worksheet but that does not seem
to work.

.LeftHeader = .Shapes.AddPicture("C:\Documents and Settings\My
Documents\Logo.jpeg", False, True, 10, 10, 70, 70)

I note that there does not seem to be a method of manually adding a picture
to the header so my guess is that it is just not possible, but would like
confirmation either that my guess it correct or that there is a way to add a
picture using VBZ.

Regards


DavidC



All times are GMT +1. The time now is 02:22 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com