#1
|
|||
|
|||
How to resize the image in the header so that it fits the page
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 |
#2
|
|||
|
|||
I figure this out, as well.
The margins of the page must be smaller than the header size, otherwise it will be cut off. It's all matter of fine tuning the margins and the image size. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
right side of table off edge of page, how to resize? | erik2000 | Word Tables | 1 | 03-29-2013 11:12 AM |
Calendar - Page resize problem | Rager | Word | 1 | 12-17-2012 02:01 PM |
Image proportional resize not functioning! | alexfcm | PowerPoint | 0 | 09-27-2012 07:22 AM |
100% opacity on image in header | yAnn1ck | Word | 1 | 04-05-2012 03:58 PM |
WORD Macro - import picture - resize - position - page break - loop | Nano07 | Word VBA | 2 | 11-02-2011 05:14 AM |