Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have this code that export an Excel chart and it's working fine

Sub ExportChart(ByVal fileName As String)
     '   Export a selected chart as a picture    
    Const sPicType$ = ".png"
    Dim sChartName$
    Dim objChart As ChartObject 
    Set objChart = ActiveSheet.ChartObjects(1)
    If objChart Is Nothing Then
        Exit Sub
    End If
    sPath = fileName & sPicType
    objChart.Chart.Export fileName:=sPath, FilterName:="PNG"
    Application.DisplayAlerts = False
    ActiveWorkbook.Saved = True     
End Sub

Except that I added a textarea on the chart and it doesn't show in the exported image. Any suggestions ?

share|improve this question
Just to ask the obvious question: If you copy objChart to another sheet within the same workbook: Is the textbox copied too? – nixda Jan 10 '13 at 18:09
No, because the textbox is not part of the chart. – outellou Jan 10 '13 at 18:22
If the chart is selected when you create the text box, it will be a part of the chart. – chuff Jan 10 '13 at 23:05
up vote 1 down vote accepted

If you select the chart before you insert the text box, it will be a part of the chart and export properly.

share|improve this answer
If you didn't select the chart before inserting the textbox, you can copy the textbox, select the chart, and paste. The textbox is now part of the chart, and you can position it as desired. – Jon Peltier Jan 15 '13 at 3:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .