Make sure you put the code under the ThisWorkbook module.
And this routine isn't designed to run on demand (manually). Instead it runs
when you print or printpreview.
mykmag wrote:
Thank you for your answer.
I have no problems getting the code in the editor, and it compiles) without
any messages. But when I put some text i A1 inn sheet1 I cannot see any
result in neither heading noe footer after having run the program. I need a
litle detailed help here. I have programmed in dBASE and a little in Pascal
(and Simula/Basic/Fortran) but that was many years ago. And this is a whole
new story. I use a downloaded version of excel 2003.I think thou I understand
the main lines in the program. But I keep getting no result . I supose I may
put the program in the wrong place- shall it be placed in the sheet1 or in a
module?
Thank you
Magnar M.
"Dave Peterson" wrote:
VBA is built into excel (as well a bunch of other programs). But I believe you
do have to choose to install it.
If you click on Tools|macro|Visual basic editor, do you have any problems?
(VB--plain old Visual Basic is a stand alone program. But you don't need it to
write macros in excel/word/powerpoint....).
mykmag wrote:
Thank you very much. Of your name I guess you are of Swedish origin. I
myself, is Norwegian.
I would like to know if VisualBasic,VBA is build in Excel 2003 or must I
have the whole program to make a macro? I think I have a CD with some old
program on, and I have some programming experience mainly with dBASE and a
litle Pascal and I have tried some VBA as well (very little).
Yours
Magnar Myklebust (retired)
Ellingsrudlia 24
1400 Ski
Norway
E-mail
"Dave Peterson" wrote:
If you use VBA, you can.
Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)
With Worksheets("sheet1")
.PageSetup.RightHeader = "This is what's in A1: " & .Range("A1").Text
.PageSetup.LeftHeader = Format(Date, "mmmm dd, yyyy")
End With
End Sub
This kind of code goes behind the ThisWorkbook module.
If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
mykmag wrote:
Is it possibe to insert a cell referance/link of your own make, in the
heading/footer of a page/sheet in Excel 2003?
--
Dave Peterson
--
Dave Peterson
--
Dave Peterson