Wrox Programmer Forums
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 16th, 2003, 03:24 AM
Registered User
 
Join Date: Nov 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Excel Header Font

how can i access the header font and size in header section of my excel via Visual basic?

 
Old December 16th, 2003, 05:25 AM
Authorized User
 
Join Date: Jun 2003
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You can set the font name/size by setting a string value such as

 &"Arial"&8 My Header

e.g.
ActiveWorkbook.Worksheets(1).PageSetup.LeftHeader = "&""Arial""&8 My Header"

this sets the left-hand header to "My Header" in Arial 8 point
 
Old March 26th, 2007, 09:53 PM
Registered User
 
Join Date: Mar 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

this was helpful...

However, how do you implement a string variable?

the following is a snippet from a macro I wrote:

Code:
Application.Worksheets("sheet1").PageSetup.LeftHeader = _
        "&""Arial,bold""&15""&  " & Worksheets("sheet2").Range("A1").Value


this seems to work (correct font and size) except that whatever the ("A1").value is it will print that preceded by a quotation mark (ie... "myvalue )

I have tried various combos within the syntax, but this is as close as I can get. I should note that the value mentioned is a number, just in case that may mean something.

any suggestions?
any help is greatly appreicated.
thanks
Nek

 
Old March 28th, 2007, 03:15 PM
Registered User
 
Join Date: Mar 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

found the solution:

http://www.cpearson.com/excel/headfoot.htm

thanks
NM






Similar Threads
Thread Thread Starter Forum Replies Last Post
Grid Column Header font problem suji VB.NET 0 June 12th, 2008 07:48 AM
set font for grid column header suji Visual Studio 2005 0 June 12th, 2008 07:40 AM
Font size of Header Text in DetailsView Control AspNetGuy ASP.NET 3.5 Basics 3 May 22nd, 2008 04:23 PM
Page Breaks and Font Style in Excel shagaset Classic ASP Professional 2 December 14th, 2004 10:30 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.