PC Review


Reply
Thread Tools Rate Thread

Custom Header

 
 
Karen53
Guest
Posts: n/a
 
      23rd Jan 2008
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 With Quote
 
 
 
 
JLGWhiz
Guest
Posts: n/a
 
      23rd Jan 2008
..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 With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can you link a custom property to an Excel custom header text? =?Utf-8?B?TG91RXJj?= Microsoft Excel Setup 0 8th Nov 2005 04:58 PM
Excel: custom header - is it possible to paste into header? =?Utf-8?B?TWF1cmVlbiBELg==?= Microsoft Excel Worksheet Functions 0 4th Nov 2005 03:07 PM
how do I permanetly add custom header to excel header list? =?Utf-8?B?R0FSWQ==?= Microsoft Excel Misc 1 15th Dec 2004 08:52 PM
including custom header fields in the "original message header" when an email is replied to Jim Rea Microsoft Outlook VBA Programming 4 31st Oct 2003 05:08 AM
including custom header fields in the "original message header" when an email is replied to Jim Rea Microsoft Outlook Form Programming 0 6th Oct 2003 02:30 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:23 PM.