View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default Header Headache!

Hi
this code goes in the workbook module. Try the following
- open your workbook
- open the VBA editor (ALT+F11)
- doubleclick on 'ThisWorkbook' in the left explorer window of the VBA
editor
- paste the code
- close the VBA editor and save the workbook

No goto print preview and have a look if it works
Note: This will link cell A1 for all sheets of your workbook!

--
Regards
Frank Kabel
Frankfurt, Germany
"CWit " schrieb im Newsbeitrag
...
Frank did a great job helping with with the code to link a cell into

the
header

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim wkSht As Worksheet
For Each wkSht In Me.Worksheets
With wkSht.PageSetup
CenterFooter = wkSht.Range("A1").value
End With
Next wkSht
End Sub

I'm right clicking on the sheet tab and pasting this code under "view
code". When I go back to the excel sheet I put the text I want in

Cell
A1. Then go to print preview and nothing, I printed and nothing. So I
Thought there might be something wrong. So I searched the forums for
the same topic and read 5 post where this same code worked for them.

Is there a step I'm missing, I'm going crazy!
I'm using Excel 2002

Thanks in advance for the asprin!

Oh and I tried opening a plain NEW excel sheet putting "JohnDoe" in
cell A1 then pasting this code in the editor, still nothing.


---
Message posted from http://www.ExcelForum.com/