Home |
Search |
Today's Posts |
#24
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Well, you lasted longer than I would have <vbg.
Karen53 wrote: HI Dave, Since it's working in the general modules, I just dumped the 'BeforePrint'. Why fight city hall. -- Thanks for your help. Karen53 "Dave Peterson" wrote: I still don't have a guess. Sorry. Karen53 wrote: Hi Dave, It will not work if it is in ThisWorkbook's 'BeforePrint' routine. However, if I move the code into the individual print routines in the general modules, it works just fine so far. -- Thanks for your help. Karen53 "Dave Peterson" wrote: Does it work when you use: File|print or File|Print preview Karen53 wrote: Hi, Also it's the same for both workbooks. It was working because I was using the print button on the toolbar. -- Thanks for your help. Karen53 "Dave Peterson" wrote: I still can't duplicate it. I don't have another guess. Karen53 wrote: Hi, So far I have tried this at home and at work with the same result. I have created a new workbook and the code works. I thought perhaps it was because the workbook was protected. So, I tried it and it still worked. There has to be something different with this workbook. I am going through what I can think of one at a time to see if it makes a difference. It executes the code but doesn't make the change. So far I haven't fouind the difference. I'll continue tying difference things tomorrow. There are only so many things I know of to try, though. I am using Excel 2003 SP2 at home. At work I believe it is version 2003 as well. I'll check tomorrow. This is so strange. I don't have a lot of experience with this. Your help is very appreciated. --- Thanks for your help. Karen53 "Dave Peterson" wrote: Just to muddy the waters... What version of excel are you using? What type of view are you using: Normal, page break preview, print layout? If you create a new workbook with just enough data for testing and plop the code in there, does that look ok? I don't have a guess why it's not working for you. Karen53 wrote: This is so frustrating! What is going on? The immediate window shows the code executing with the correct value for the header variable, yet the header on the worksheet does not change. If I do a print preview, the worksheet header changes. I've run out of things to try. -- Thanks for your help. Karen53 "Tim Zych" wrote: Try assigning it to a variable so the string can be fully resolved before it goes into the header, e.g. Dim HdrVal As String HdrVal = "&C&14&B" & SumbyLineItempg.Range("E2").Value & _ "&4" & vbCrLf & "&12&A" & vbCrLf & " " Debug.Print HdrVal .CenterHeader = HdrVal Then you can inspect it too to help narrow down the problem. -- Tim Zych SF, CA "Karen53" wrote in message ... Hi, I have the following BeforePrint routine in my ThisWorkbook module which places a custom header on pages based on the value of cells in the sheet. It worked except now if the value of the cell changes, it is not picking up the change and stays with the old value in the header. This there something I am missing? Private Sub Workbook_BeforePrint(Cancel As Boolean) 'add custom header to pages before printing With SumbyLineItempg.PageSetup .CenterHeader = "&C&14&B" & SumbyLineItempg.Range("E2").Value & _ "&4" & vbCrLf & "&12&A" & vbCrLf & " " End With With LineItemspg.PageSetup .CenterHeader = "&C&14&B" & LineItemspg.Range("C2").Value & _ "&4" & vbCrLf & "&12&A" & vbCrLf & " " End With With MainPagepg.PageSetup .CenterHeader = "&C&14&B" & MainPagepg.Range("B1").Value & _ "&4" & vbCrLf & "&12&A" & vbCrLf & " " End With End Sub -- Thanks for your help. Karen53 -- Dave Peterson -- Dave Peterson -- Dave Peterson -- Dave Peterson -- Dave Peterson |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
problem to print | New Users to Excel | |||
Print problem | Excel Programming | |||
Print problem | Excel Programming | |||
Print problem | Excel Programming | |||
Print problem | Excel Programming |