Results 1 to 4 of 4
  1. #1
    4 Star Lounger
    Join Date
    May 2004
    Location
    Toronto, Ontario, Canada
    Posts
    425
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Display graph (Excel 2000)

    Hi all,

    I have a multipage in a userform that would like to display graphs..I would like to be able to cycle through the graphs, but it doesn't work..Can someone help?

    I keep getting worksheet Chart object error...

    Thanks,

    Darryl.


    Public Sub UpdateChart()
    Dim chartnum As Integer
    Set CurrentChart = Sheets("Charts").ChartObjects(chartnum).Chart
    CurrentChart.Parent.Width = 600
    CurrentChart.Parent.Height = 300
    ' 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

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Display graph (Excel 2000)

    You don't assign chartnum a value, so it is 0. However, ChartObjects are numbered starting at 1, so ChartObjects(chartnum) is not valid.

  3. #3
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Display graph (Excel 2000)

    Your code Dims chartnum As Integer but does not assign it a value before using it as an index in the next line. Could that be the problem?
    Legare Coleman

  4. #4
    4 Star Lounger
    Join Date
    May 2004
    Location
    Toronto, Ontario, Canada
    Posts
    425
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Re: Display graph (Excel 2000)

    Thanks, I understand my mistake

    Darryl.

Posting Permissions

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