+ Reply to Thread
Results 1 to 2 of 2

How to show a chart with a shape on a userform using VBA

Hybrid View

newbi004 How to show a chart with a... 02-17-2013, 11:19 AM
newbi004 Re: How to show a chart with... 02-17-2013, 01:12 PM
  1. #1
    Forum Contributor
    Join Date
    07-23-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    211

    How to show a chart with a shape on a userform using VBA

    Hi all

    I have a half donut chart with a grouped shape. I found a code to show the chart on a userform, but the grouped shape does not show up.

    How can I show both the chart and the shape on the userform using VBA?

    The code for creating the chart image in a userform is:

    Private Sub OptionButton1_Click()
        UpdateChart 1
    End Sub
    Private Sub OptionButton2_Click()
        UpdateChart 2
    End Sub
    
    Private Sub UpdateChart(ChartNum As Integer)
      Dim currentchart As Chart, Fname As String
        Set currentchart = Sheets("Charts").ChartObjects(ChartNum).Chart
        currentchart.Parent.Width = 100
        currentchart.Parent.Height = 100
    
    '   Save chart as GIF
        Fname = ThisWorkbook.Path & Application.PathSeparator & "temp.gif"
        currentchart.Export Filename:=Fname, FilterName:="GIF"
    
    '   Show the chart
        Image1.Picture = LoadPicture(Fname)
    End Sub
    Thanks

  2. #2
    Forum Contributor
    Join Date
    07-23-2012
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    211

    Re: How to show a chart with a shape on a userform using VBA

    Any suggestions?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1