Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 191
Default chart formatting

I need a macro that will, with the selected graph, do some operations to the
axis font (both primary and secondary), as well as a few other things, before
selecting the next graph in the page.

Any code help that can get me started on these tasks (I'm hoping once I see
the format of how to do the format manipulations, I can figure out the other
things I need to do, which are also formatting related).

I have already tried recording the macro, and it won't show me what it does
to change fonts and the like. Just records that I select the components of
the graph, which is not good enough, as the whole point is to avoid having to
do the changing once the components are selected. The selecting is the easy
part. Messing with the settings is what I need automated (I have about 200
graphs to go through each quarter).

Thx.
--
Boris
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default chart formatting

Here is what I recorded changing the font attributes to both the primary and
secondary axis. Please elaborate on what you don't understand about the
code.


If you don't want to select anything, then you just use the recorded code to
guide you through the object model. For example to get the current font for
the primary axis tick labels:

?
activesheet.ChartObjects(1).Chart.Axes(xlValue,xlS econdary).TickLabels.Font.Name
Book Antiqua

(demo's from the immediate window). You could use the same command to set
the name of the font. Font is an object and has many properties. So all
those are available.

Sub Macro7()
'
' Macro7 Macro
' Macro recorded 06/18/2007 by OGILVTW
'

'
ActiveChart.Axes(xlValue, xlPrimary).Select
Selection.TickLabels.AutoScaleFont = True
With Selection.TickLabels.Font
.Name = "AvantGarde"
.FontStyle = "Regular"
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
ActiveChart.Axes(xlValue, xlSecondary).Select
Selection.TickLabels.NumberFormat = "#,##0,"
Selection.TickLabels.AutoScaleFont = True
With Selection.TickLabels.Font
.Name = "Book Antiqua"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
End Sub

--
Regards,
Tom Ogilvy


"BorisS" wrote:

I need a macro that will, with the selected graph, do some operations to the
axis font (both primary and secondary), as well as a few other things, before
selecting the next graph in the page.

Any code help that can get me started on these tasks (I'm hoping once I see
the format of how to do the format manipulations, I can figure out the other
things I need to do, which are also formatting related).

I have already tried recording the macro, and it won't show me what it does
to change fonts and the like. Just records that I select the components of
the graph, which is not good enough, as the whole point is to avoid having to
do the changing once the components are selected. The selecting is the easy
part. Messing with the settings is what I need automated (I have about 200
graphs to go through each quarter).

Thx.
--
Boris

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 191
Default chart formatting

thanks, Tom. Think I get what you wrote, and it worked. Further help, if
you don't mind. How do I call out the following objects (for similar
formatting):

axis title (primary and secondary, if there's a diff other than just
xlPrimary/Secondary)
chart title
legend placement

more importantly, is there a resource that lists all these things out in an
easy to use fashion, whether online help or book of some sort (preference for
former, of course)?

Thx.
--
Boris


"Tom Ogilvy" wrote:

Here is what I recorded changing the font attributes to both the primary and
secondary axis. Please elaborate on what you don't understand about the
code.


If you don't want to select anything, then you just use the recorded code to
guide you through the object model. For example to get the current font for
the primary axis tick labels:

?
activesheet.ChartObjects(1).Chart.Axes(xlValue,xlS econdary).TickLabels.Font.Name
Book Antiqua

(demo's from the immediate window). You could use the same command to set
the name of the font. Font is an object and has many properties. So all
those are available.

Sub Macro7()
'
' Macro7 Macro
' Macro recorded 06/18/2007 by OGILVTW
'

'
ActiveChart.Axes(xlValue, xlPrimary).Select
Selection.TickLabels.AutoScaleFont = True
With Selection.TickLabels.Font
.Name = "AvantGarde"
.FontStyle = "Regular"
.Size = 11
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
ActiveChart.Axes(xlValue, xlSecondary).Select
Selection.TickLabels.NumberFormat = "#,##0,"
Selection.TickLabels.AutoScaleFont = True
With Selection.TickLabels.Font
.Name = "Book Antiqua"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
.Background = xlAutomatic
End With
End Sub

--
Regards,
Tom Ogilvy


"BorisS" wrote:

I need a macro that will, with the selected graph, do some operations to the
axis font (both primary and secondary), as well as a few other things, before
selecting the next graph in the page.

Any code help that can get me started on these tasks (I'm hoping once I see
the format of how to do the format manipulations, I can figure out the other
things I need to do, which are also formatting related).

I have already tried recording the macro, and it won't show me what it does
to change fonts and the like. Just records that I select the components of
the graph, which is not good enough, as the whole point is to avoid having to
do the changing once the components are selected. The selecting is the easy
part. Messing with the settings is what I need automated (I have about 200
graphs to go through each quarter).

Thx.
--
Boris

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
copy chart formatting and chart templates in Excel 2007 Astelix Charts and Charting in Excel 4 March 4th 10 04:10 AM
Pivot Chart Refresh cancels all chart formatting Nico[_2_] Charts and Charting in Excel 2 September 9th 07 05:22 AM
Pivot Table border formatting and pivot chart formatting [email protected] Excel Discussion (Misc queries) 0 July 22nd 05 02:22 PM
Chart formatting Christianovitch Charts and Charting in Excel 1 January 19th 05 10:55 PM
Chart formatting Christopher Anderson Excel Discussion (Misc queries) 1 December 17th 04 04:53 AM


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