Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.charting,microsoft.public.excel.programming
|
|||
|
|||
![]()
Jon Peltier wrote in message ...
Another approach: don't keep deleting and adding charts. Just reuse one chart, change its source data range and other particulars and export it, then repeat as needed. - Jon Thanks for the tip Jon! Much cleaner and faster. I did run into the "too many fonts for this worksheet" bug when using the same chart and repopulating it, thus I had to add the "AutoScaleFont = False" statement, and also set AutoScaleFont = False in the separate chart creation Sub. Great web site as well. The codeblock I used is below: Public Sub GraphExport(TitleId As String, suffix As String, xLabel As String, expt As String) ''' Select precreated chart, only create once ActiveSheet.ChartObjects(1).Activate ActiveChart.ChartArea.Select ''' Required to avoid too many fonts bug Selection.AutoScaleFont = False With ActiveChart .ChartTitle.Characters.Text = _ expt + " for " + ChartId .Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Units" End With ActiveChart.HasLegend = False ActiveChart.SeriesCollection(1).Select ActiveChart.Axes(xlCategory).Select Selection.TickLabels.Font.Bold = True ActiveChart.ChartTitle.Select Selection.Font.Bold = True ActiveChart.ChartArea.Select ActiveChart.Axes(xlValue).Select Selection.TickLabels.Font.Bold = True With ActiveChart.Parent .Width = 600 .Height = 300 End With Selection.TickLabels.Font.Bold = True ''' Export file Dim FileName As String FileName = "C:\JUNK\" + suffix + "\" + ProbeId + "_" + suffix + ".gif" FileName = Replace(FileName, "/", "_") ActiveChart.Export FileName:=FileName, FilterName:="GIF" End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I disable automatic chart creation in Excel? | Charts and Charting in Excel | |||
Excel 2007 Chart creation | Charts and Charting in Excel | |||
Excel 2007 Chart creation | Charts and Charting in Excel | |||
chart creation | Charts and Charting in Excel | |||
Excel chart creation | Excel Discussion (Misc queries) |