Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Font in Header - @22 "25 Miles" goes to 409 font

Hello,

MS EXCEL 2003 in XP PRO (Actually controlled from vba in access 03)

Hello.

I am trying to set the header in vba for the print area in excel. The code
is right but the problem is if the variable starts with a number.

..CenterHeader = "&""Copperplate Gothic Bold,Bold""&22" &
CStr(in_ChecklistName & " Checklist")

if in_ChecklistName starts with a number, it contributes to the font size.

So if

in_ChecklistName = "25 Mile Drive"

then it behaves as if the code read like so.

..CenterHeader = "&""Copperplate Gothic Bold,Bold""&2225"" Mile Drive"

Which obviously causes the header font to go HUGE.

What can I do to fix this? Note: works perfectly if the in_ChecklistName
variable starts with a letter.

Thanks.

--
BlueWolverine
MSE - Mech. Eng.
Go BLUE!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Font in Header - @22 "25 Miles" goes to 409 font

put a space between the characters:

..CenterHeader = "&""Copperplate Gothic Bold,Bold""&22 " _
& CStr(in_ChecklistName & " Checklist")

or

..CenterHeader = "&""Copperplate Gothic Bold,Bold""&22" & " " _
& CStr(in_ChecklistName & " Checklist")

I'd drop the cStr() stuff. VBA will see it as a string since you're
concatenating strings

..CenterHeader = "&""Copperplate Gothic Bold,Bold""&22 " _
& in_ChecklistName & " Checklist"



BlueWolverine wrote:

Hello,

MS EXCEL 2003 in XP PRO (Actually controlled from vba in access 03)

Hello.

I am trying to set the header in vba for the print area in excel. The code
is right but the problem is if the variable starts with a number.

.CenterHeader = "&""Copperplate Gothic Bold,Bold""&22" &
CStr(in_ChecklistName & " Checklist")

if in_ChecklistName starts with a number, it contributes to the font size.

So if

in_ChecklistName = "25 Mile Drive"

then it behaves as if the code read like so.

.CenterHeader = "&""Copperplate Gothic Bold,Bold""&2225"" Mile Drive"

Which obviously causes the header font to go HUGE.

What can I do to fix this? Note: works perfectly if the in_ChecklistName
variable starts with a letter.

Thanks.

--
BlueWolverine
MSE - Mech. Eng.
Go BLUE!


--

Dave Peterson
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
Standard font in a "New Microsoft Excel Worksheet.xls" wont change Prunetart Excel Discussion (Misc queries) 0 September 15th 06 10:36 AM
Where is the toolbar with the "bold type", "font type", options fwccbcc New Users to Excel 2 May 3rd 06 09:11 PM
Any IF(A2=font color=red", "1", "0") in excel? Or a way to do it? Steve Excel Discussion (Misc queries) 1 November 7th 05 02:48 PM
How do I "conditionally" change font size based on text length? Found in Florida Excel Programming 2 October 10th 05 11:12 PM
How can I make cell A1 a "Y" or "N" depending upon cell A2's font color? Please help. [email protected] Excel Programming 1 October 16th 03 08:32 PM


All times are GMT +1. The time now is 11:03 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"