Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2008

Tip: Looking for answers? Try searching our database.

Custom Header

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Karen53 - 23 Jan 2008 20:21 GMT
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

Signature

Thanks for your help.
Karen53

JLGWhiz - 23 Jan 2008 21:00 GMT
.CenterHeader = "&""Arial,Bold""&12" & NewHeader

Should be:  

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

> Hi,
>
[quoted text clipped - 31 lines]
>    
>     NewHeader = ThisYear & " " & InvoiceName & " Invoice " & InvoiceType
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.