View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
JacMar JacMar is offline
external usenet poster
 
Posts: 12
Default 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