Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Headers and Footers in VBA
I use Excel 2002. I recently got info from this group about printing headers
and footers on selected pages, and it worked very well. Now my question is; How do I specify a multi line header (of footer), in a format similar to an address, ie: Name Street address City, State Zip Code I have not been able to find code to force a Carriage Return. Thanks in advance |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Headers and Footers in VBA
Private Sub Workbook_BeforePrint(Cancel As Boolean)
With ActiveSheet.PageSetup .LeftHeader = "Line 1" & vbCr & "Line 2" End With End Sub 'This is workbook event code. 'To input this code, right click on the Excel icon on the worksheet '(or next to the File menu if you maximise your workbooks), 'select View Code from the menu, and paste the code -- HTH Bob Phillips (there's no email, no snail mail, but somewhere should be gmail in my addy) "JacMar" wrote in message ... I use Excel 2002. I recently got info from this group about printing headers and footers on selected pages, and it worked very well. Now my question is; How do I specify a multi line header (of footer), in a format similar to an address, ie: Name Street address City, State Zip Code I have not been able to find code to force a Carriage Return. Thanks in advance |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Headers and Footers in VBA
Thanks Bob Phillips: this helped a lot. But I have now discovered a couple
other problems: The setup is as follows: I have a logo (picture) to print as a left header. It works. Then I want to print the complete address, to the right of that left header. I tried to use CenterHeader for that. But it prints the multi lines of text with a "center" format. I'd like it to be left justified. If I use "&L", it justifies it to the left of the sheet of paper, and writes over the logo. I thought that LeftHeader, CenterHeader and Right Header divided the page in three seperate regions. It seems not. How can I left justify multiline text, to the right of my LeftFooter logo? I would also like to add text (Annex "X" to Contract "Y" for example), under the picture logo, left justified to the page. If I use LeftHeader, it writes it top left and the picture logo dissappears. If I use CenterHeader, put a bunch of blank lines and then asks that the text be left justified, it overwrites the logo on the top left, seemingly ignoring the blank lines. How do I do it. Thanks again, you have all been very helpful "Bob Phillips" wrote: Private Sub Workbook_BeforePrint(Cancel As Boolean) With ActiveSheet.PageSetup .LeftHeader = "Line 1" & vbCr & "Line 2" End With End Sub 'This is workbook event code. 'To input this code, right click on the Excel icon on the worksheet '(or next to the File menu if you maximise your workbooks), 'select View Code from the menu, and paste the code -- HTH Bob Phillips (there's no email, no snail mail, but somewhere should be gmail in my addy) "JacMar" wrote in message ... I use Excel 2002. I recently got info from this group about printing headers and footers on selected pages, and it worked very well. Now my question is; How do I specify a multi line header (of footer), in a format similar to an address, ie: Name Street address City, State Zip Code I have not been able to find code to force a Carriage Return. Thanks in advance |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Headers and Footers in VBA
On the first point, text in the centre heading area is centred, and I don't
know how to avoid that. Perhaps you could put the address in the left header and the picture centred or right, or put the address in the right header, it will be right aligned, but that won't be as bad as centre aligned. -- HTH Bob Phillips (there's no email, no snail mail, but somewhere should be gmail in my addy) "JacMar" wrote in message ... Thanks Bob Phillips: this helped a lot. But I have now discovered a couple other problems: The setup is as follows: I have a logo (picture) to as a left header. It works. Then I want to print the complete address, to the right of that left header. I tried to use CenterHeader for that. But it prints the multi lines of text with a "center" format. I'd like it to be left justified. If I use "&L", it justifies it to the left of the sheet of paper, and writes over the logo. I thought that LeftHeader, CenterHeader and Right Header divided the page in three seperate regions. It seems not. How can I left justify multiline text, to the right of my LeftFooter logo? I would also like to add text (Annex "X" to Contract "Y" for example), under the picture logo, left justified to the page. If I use LeftHeader, it writes it top left and the picture logo dissappears. If I use CenterHeader, put a bunch of blank lines and then asks that the text be left justified, it overwrites the logo on the top left, seemingly ignoring the blank lines. How do I do it. Thanks again, you have all been very helpful "Bob Phillips" wrote: Private Sub Workbook_BeforePrint(Cancel As Boolean) With ActiveSheet.PageSetup .LeftHeader = "Line 1" & vbCr & "Line 2" End With End Sub 'This is workbook event code. 'To input this code, right click on the Excel icon on the worksheet '(or next to the File menu if you maximise your workbooks), 'select View Code from the menu, and paste the code -- HTH Bob Phillips (there's no email, no snail mail, but somewhere should be gmail in my addy) "JacMar" wrote in message ... I use Excel 2002. I recently got info from this group about printing headers and footers on selected pages, and it worked very well. Now my question is; How do I specify a multi line header (of footer), in a format similar to an address, ie: Name Street address City, State Zip Code I have not been able to find code to force a Carriage Return. Thanks in advance |
#5
Posted to microsoft.public.excel.misc
|
|||
|
|||
Headers and Footers in VBA
Thanks. Actually, plan B was to put the address as a RightHeader. How about
my second question: where I have not been able to put text under the picture logo? Because the data in this text will change, I cannot incorporate it in the picture logo. Any suggestions? Thanks again "Bob Phillips" wrote: On the first point, text in the centre heading area is centred, and I don't know how to avoid that. Perhaps you could put the address in the left header and the picture centred or right, or put the address in the right header, it will be right aligned, but that won't be as bad as centre aligned. -- HTH Bob Phillips (there's no email, no snail mail, but somewhere should be gmail in my addy) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can I save custom headers and footers to use in other files? | Excel Worksheet Functions | |||
How do you protect Headers and Footers in MOFFICE | Excel Worksheet Functions | |||
Copy Headers and Footers between wookbooks | Excel Discussion (Misc queries) | |||
headers and footers | Excel Discussion (Misc queries) | |||
Pre-set headers and footers for new worksheets | Excel Discussion (Misc queries) |