Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 333
Default Custom Header

Hi,

I'm trying to add a custom header based on worksheet cell values, so I've
created the variable 'NewHeader'. When I run the code, the header font is
HUGE even though I've indicated 12 pt. What have I done wrong?

Sub AddNewInvoiceHeader(NewHeader, InvoiceName, ShName)

If InvoiceName = "CAM" Then
Sheets(ShName).PageSetup.PrintArea = "$E$10:$O$52"
Else
Sheets(ShName).PageSetup.PrintArea = "$S$10:$AC$52"
End If
With Sheets(ShName).PageSetup
.LeftHeader = ""
.CenterHeader = "&""Arial,Bold""&12" & NewHeader
.RightHeader = ""
.HeaderMargin = Application.InchesToPoints(0.5)
.CenterHorizontally = True
.CenterVertically = False
End With

End Sub

Here is the code assigning 'NewHeader'L

ThisYear = Left(LineItemspg.Range("E13"), 4)

If MainPagepg.Range("D6").Value = "Yes" Then
InvoiceType = "Reconciliation"
Else
InvoiceType = "Deposit"
End If

NewHeader = ThisYear & " " & InvoiceName & " Invoice " & InvoiceType



--
Thanks for your help.
Karen53
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Custom Header

..CenterHeader = "&""Arial,Bold""&12" & NewHeader

Should be:

..CenterHeader = " &"Arial" &B &12" & NewHeader
I assume that NewHeader is a variable for the text.


"Karen53" wrote:

Hi,

I'm trying to add a custom header based on worksheet cell values, so I've
created the variable 'NewHeader'. When I run the code, the header font is
HUGE even though I've indicated 12 pt. What have I done wrong?

Sub AddNewInvoiceHeader(NewHeader, InvoiceName, ShName)

If InvoiceName = "CAM" Then
Sheets(ShName).PageSetup.PrintArea = "$E$10:$O$52"
Else
Sheets(ShName).PageSetup.PrintArea = "$S$10:$AC$52"
End If
With Sheets(ShName).PageSetup
.LeftHeader = ""
.CenterHeader = "&""Arial,Bold""&12" & NewHeader
.RightHeader = ""
.HeaderMargin = Application.InchesToPoints(0.5)
.CenterHorizontally = True
.CenterVertically = False
End With

End Sub

Here is the code assigning 'NewHeader'L

ThisYear = Left(LineItemspg.Range("E13"), 4)

If MainPagepg.Range("D6").Value = "Yes" Then
InvoiceType = "Reconciliation"
Else
InvoiceType = "Deposit"
End If

NewHeader = ThisYear & " " & InvoiceName & " Invoice " & InvoiceType



--
Thanks for your help.
Karen53

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
custom header ct_pws_3 New Users to Excel 3 March 11th 09 04:28 PM
Can you link a custom property to an Excel custom header text? LouErc Setting up and Configuration of Excel 0 November 8th 05 04:58 PM
Excel: custom header - is it possible to paste into header? Maureen D. Excel Worksheet Functions 0 November 4th 05 03:07 PM
Custom Header Richard Excel Programming 4 October 21st 05 01:17 AM
how do I permanetly add custom header to excel header list? GARY Excel Discussion (Misc queries) 1 December 15th 04 08:52 PM


All times are GMT +1. The time now is 01:22 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"