Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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. –  Moh 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
add comment

1 Answer

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
1  
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.