Hello,
I am working on a macro to insert an image as the header. This image as a box on the border, but when I print the spreadsheet, the "sides" of the box are not printed.
The problem doesn't lie in the printer borders since I have the same letterhead in Word (same size) and the borders are correctly printed.
How can I make sure they are displayed?
Also, the image quality in print is kind of poor. How can I improve that?
The footer is inserted as a text, so the difference is noticeable. My image itself is of the correct quality (taken as a snapshot of the Word letterhead).
This is the code I am using:
Code:
Sub MyLetterhead()
ActiveSheet.PageSetup.CenterHeaderPicture.Filename = _
"C:\header_macro\header.png"
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = "&G"
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.CentimetersToPoints(1.9)
.RightMargin = Application.CentimetersToPoints(0.7)
.TopMargin = Application.CentimetersToPoints(1.2)
.BottomMargin = Application.CentimetersToPoints(0.9)
.HeaderMargin = Application.CentimetersToPoints(0.4)
.FooterMargin = Application.InchesToPoints(0.2)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = False
.PrintErrors = xlPrintErrorsDisplayed
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.ScaleWithDocHeaderFooter = True
.AlignMarginsHeaderFooter = True
.EvenPage.LeftHeader.Text = ""
.EvenPage.CenterHeader.Text = ""
.EvenPage.RightHeader.Text = ""
.EvenPage.LeftFooter.Text = ""
.EvenPage.CenterFooter.Text = ""
.EvenPage.RightFooter.Text = ""
.FirstPage.LeftHeader.Text = ""
.FirstPage.CenterHeader.Text = ""
.FirstPage.RightHeader.Text = ""
.FirstPage.LeftFooter.Text = ""
.FirstPage.CenterFooter.Text = ""
.FirstPage.RightFooter.Text = ""
.FitToPagesWide = 1
.FitToPagesTall = False
End With
End Sub