Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
ts1 ts1 is offline
external usenet poster
 
Posts: 6
Default Formatting separate lines of header

I have the following code to set the worksheet headers. All lines in the
header are printing in the set font size FS but I want to have a different
font size for each variable/line of the header. Any help would be much
appreciated. ts1

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim wkSht As Worksheet
Dim CoName As String
Dim EffDate As String
Dim InsType As String

CoName = Range("Sheet1!b2").Value
EffDate = Range("Sheet1!b4").Value
InsType = "My Text String"
FS = 22

For Each wkSht In ThisWorkbook.Worksheets
wkSht.PageSetup.CenterHeader = "&""Arial,Bold""&" & FS & Chr(10) &
CoName & Chr(10) & InsType & Chr(10) & EffDate
Next wkSht
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Formatting separate lines of header

Easiest and most specific solution is to
Turn on the macro recorder and set it up manually.
Then turn the macro recorder off and look at the code. It will show you
that you just embed more "Font" commands within the test string.

--
Regards,
Tom Ogilvy


"ts1" wrote in message
...
I have the following code to set the worksheet headers. All lines in the
header are printing in the set font size FS but I want to have a different
font size for each variable/line of the header. Any help would be much
appreciated. ts1

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim wkSht As Worksheet
Dim CoName As String
Dim EffDate As String
Dim InsType As String

CoName = Range("Sheet1!b2").Value
EffDate = Range("Sheet1!b4").Value
InsType = "My Text String"
FS = 22

For Each wkSht In ThisWorkbook.Worksheets
wkSht.PageSetup.CenterHeader = "&""Arial,Bold""&" & FS & Chr(10) &
CoName & Chr(10) & InsType & Chr(10) & EffDate
Next wkSht
End Sub




  #3   Report Post  
Posted to microsoft.public.excel.programming
ts1 ts1 is offline
external usenet poster
 
Posts: 6
Default Formatting separate lines of header

Tom,

Thanks for the direction. I did that whwien setting the header to simple
text strings but am still having problem with font commands preceding
variables which are being set in the code from values in one of the
worksheets.

ts1

"Tom Ogilvy" wrote:

Easiest and most specific solution is to
Turn on the macro recorder and set it up manually.
Then turn the macro recorder off and look at the code. It will show you
that you just embed more "Font" commands within the test string.

--
Regards,
Tom Ogilvy


"ts1" wrote in message
...
I have the following code to set the worksheet headers. All lines in the
header are printing in the set font size FS but I want to have a different
font size for each variable/line of the header. Any help would be much
appreciated. ts1

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim wkSht As Worksheet
Dim CoName As String
Dim EffDate As String
Dim InsType As String

CoName = Range("Sheet1!b2").Value
EffDate = Range("Sheet1!b4").Value
InsType = "My Text String"
FS = 22

For Each wkSht In ThisWorkbook.Worksheets
wkSht.PageSetup.CenterHeader = "&""Arial,Bold""&" & FS & Chr(10) &
CoName & Chr(10) & InsType & Chr(10) & EffDate
Next wkSht
End Sub





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Formatting separate lines of header

You can test your results in the Immediate window in the VBE (under the View
menu if you don't have it visible)

? "abc """ & Range("B9").Value & """ efg" <cr

for example.

Make work with your strings until you get the desired result. Obviously the
use of the & as a delimiter in the page formatting string makes it confusing
when you are concatenating.

--
Regards,
Tom Ogilvy

"ts1" wrote in message
...
Tom,

Thanks for the direction. I did that whwien setting the header to simple
text strings but am still having problem with font commands preceding
variables which are being set in the code from values in one of the
worksheets.

ts1

"Tom Ogilvy" wrote:

Easiest and most specific solution is to
Turn on the macro recorder and set it up manually.
Then turn the macro recorder off and look at the code. It will show you
that you just embed more "Font" commands within the test string.

--
Regards,
Tom Ogilvy


"ts1" wrote in message
...
I have the following code to set the worksheet headers. All lines in

the
header are printing in the set font size FS but I want to have a

different
font size for each variable/line of the header. Any help would be much
appreciated. ts1

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim wkSht As Worksheet
Dim CoName As String
Dim EffDate As String
Dim InsType As String

CoName = Range("Sheet1!b2").Value
EffDate = Range("Sheet1!b4").Value
InsType = "My Text String"
FS = 22

For Each wkSht In ThisWorkbook.Worksheets
wkSht.PageSetup.CenterHeader = "&""Arial,Bold""&" & FS &

Chr(10) &
CoName & Chr(10) & InsType & Chr(10) & EffDate
Next wkSht
End Sub







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
separate lines in excel Kevin Excel Discussion (Misc queries) 4 May 12th 10 08:22 PM
how to merge 2 cells and have them on 2 separate lines in a cell Kerry Excel Discussion (Misc queries) 7 August 13th 09 05:41 PM
Separate lines in Excel cell BobO''''''''B Excel Worksheet Functions 5 May 31st 07 08:56 PM
Separate Groups by Inserting Lines ConfusedNHouston Excel Discussion (Misc queries) 2 October 17th 05 03:49 PM
Formatting text in a textbox to show separate lines L Mehl Excel Programming 4 February 23rd 04 05:34 PM


All times are GMT +1. The time now is 02:05 AM.

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"