?
Solved

How to set the font for CategoryNames in VB?

Posted on 2003-03-17
6
Medium Priority
?
367 Views
Last Modified: 2013-12-03
Sometimes things that look easy are a bit hard in VB... How can I set the font for CategoryNames?? This is hard for a novice in VB.

My code (I use a radar chart):
Worksheets("Test").ChartObjects(1).Chart.Axes(xlCategory).CategoryNames = Worksheets("Test").Range("A1:A5")

...and then I need to set the font size...


Roar, Norway
0
Comment
Question by:roarbov
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 43

Expert Comment

by:TimCottee
ID: 8151877
Hi roarbov,

    With Worksheets("Test").ChartObjects(1).Chart.Axes(xlCategory).TickLabels.Font
        .Name = "Arial"
        .FontStyle = "Bold Italic"
        .Size = 16
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ColorIndex = xlAutomatic
        .Background = xlAutomatic
    End With

For example.

Tim Cottee MCSD, MCDBA, CPIM
http://www.timcottee.tk 

Brainbench MVP for Visual Basic
http://www.brainbench.com

Experts-Exchange Advisory Board Member
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 8152184
For y-title


With Worksheets("Sheet1").ChartObjects(1).Chart.Axes(xlCategory).AxisTitle.Font

        .Name = "Arial"
        .FontStyle = "Italic"
        .Size = 10
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ColorIndex = xlAutomatic
        .Background = xlAutomatic
    End With


For x-title
replace xlCategory to xlValue
0
 

Author Comment

by:roarbov
ID: 8158032
Hello.
Thanks for answering, but this TickLabels method doesn't work for my xlRadar chart - I get an error message like "cannot find this property..." on ThickLabels...!

But it helped me to find something that works..:
With Worksheets("Sheet1").ChartObjects(1).Chart.ChartGroups(1)
      .HasRadarAxisLabels = True
      .RadarAxisLabels.Font.Size = 12
End With

This is probably because its a radar chart - and I think its the same problem with pie chart, but the strange thing is that I have to set the source for this labels like this with a Axes-reference:

Worksheets("Test").ChartObjects(1).Chart.Axes(xlCategory).CategoryNames = Worksheets("Test").Range("A1:A5")

If someone can explain this problem I will accept the answer....
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 8158610
Have you tried to use record the macro


From tool->macro-> record macro
After you've finished, press Alt-F11 to see the code
0
 

Accepted Solution

by:
DigitalXtreme earned 0 total points
ID: 8542720
roarbov has requested that this question be PAQ'ed and points refunded. If there are no objections to this in 72 hours I will perform this action. please post objections here.

DigitalXtreme
CS Moderator
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question