Capture chart elements in VB
Is there anyway, if I have an existing chart that is formatted already, to
capture the all elements of that chart in VB (by recording a macro perhaps)? Have a spreadsheet that contains hundreds of charts, all of which are the same format, but due to non-adjacent data sources and multiple chart types within one chart, it's very tempermental - need to standardize. Also, is there a list contained within a spreadsheet of all components of that spreadsheet? Primarily trying to capture the chart names to utilize in VB coding without having to start recording a macro and then selecting each and every chart. |
Is there anyway, if I have an existing chart that is formatted already, to capture the all elements of that chart in VB (by recording a macro perhaps)? You want to capture the formats? You can copy a chart, then paste special as formats only. This overwrites your chart title and axis titles, so in a VBA procedure, you should store these text items in string variables, then copy-paste the format, then reapply the titles. This might be a use for user-defined chart types, as well: http://peltiertech.com/Excel/ChartsH...stomTypes.html Again, note that the titles are hosed. Have a spreadsheet that contains hundreds of charts, all of which are the same format, but due to non-adjacent data sources and multiple chart types within one chart, it's very tempermental - need to standardize. Also, is there a list contained within a spreadsheet of all components of that spreadsheet? Primarily trying to capture the chart names to utilize in VB coding without having to start recording a macro and then selecting each and every chart. To get a list of chart object names: For Each chobChartObject in ActiveSheet.ChartObjects Debug.Print chobChartObject.Name Next To run a macro on each embedded chart For Each chobChartObject in ActiveSheet.ChartObjects With chobChartObject.Chart ' your code goes here End With Next - Jon ------- Jon Peltier, Microsoft Excel MVP Peltier Technical Services Tutorials and Custom Solutions http://PeltierTech.com/ _______ |
All times are GMT +1. The time now is 06:03 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com