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 |
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 |
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 |
All times are GMT +1. The time now is 01:05 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com