none
Interactive Chart in Workbook RRS feed

  • Question

  • Hello,

    I am using VBA in Excel 2010. I'm wondering if it is possible to have an excel chart within a VBA userform which can still be interacted with as if it were in excel, for example hovering over a data point would present information about the data point, as it does in excel. If possible, could anyone advise on how it is done?

    Thanks!

    Christian Taylor

    Wednesday, September 28, 2016 1:36 PM

Answers

  • Hi ChristianTaylor,

    According to your description, you could just involve saving the chart as a GIF file, and then displaying the GIF in an Image control,but it is impossible to achieve your requirement that hovering over a data point would present information about the data point.  

    If you want to display a chart in a Userform, refer to below code:
    Private Sub UserForm_Initialize()
        Dim Fname As String
    
        Call SaveChart
        Fname = ThisWorkbook.Path & "\temp1.gif"
        Me.Image1.Picture = LoadPicture(Fname)
    End Sub
    
    Private Sub SaveChart()
        Dim MyChart As Chart
        Dim Fname As String
    
        Set MyChart = Sheets("Data").ChartObjects(1).Chart
        Fname = ThisWorkbook.Path & "\temp1.gif"
        MyChart.Export Filename:=Fname, FilterName:="GIF"
    End Sub

    In addition if you have any feedback for Excel, please feel free to submit them to User Voice:

    https://excel.uservoice.com/

    Thanks for your understanding.
    • Edited by David_JunFeng Thursday, September 29, 2016 2:38 AM
    • Proposed as answer by David_JunFeng Wednesday, October 5, 2016 1:45 PM
    • Marked as answer by David_JunFeng Wednesday, October 5, 2016 1:45 PM
    Thursday, September 29, 2016 2:37 AM