Results 1 to 5 of 5

Thread: Change chart type

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2005
    Posts
    20

    Question Change chart type

    Hi all,
    I have a workbook that includes a pie chart with name “graph1” on a worksheet. I ask from a user to change the chart type to columns. I need a code that checks if the user makes the right changes or not. I tried the following code without success:

    VB Code:
    1. Dim xlap As New Excel.Application 'a reference to excel
    2. With xlap.Charts(“graph1”).Add '<---??
    3. If xlap.ActiveChart.ChartType = xlColumnClustered Then
    4. msgbox “right answer”
    5. End If
    6. End With

    Please Help!
    Thanks in advance

  2. #2
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Change chart type

    are u doing thin in excel?? or from external app (VB)
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Oct 2005
    Posts
    20

    Re: Change chart type

    I am trying from external VB6 app.

  4. #4
    Fanatic Member dannymking's Avatar
    Join Date
    Jul 2005
    Location
    Darlington, North East UK
    Posts
    677

    Re: Change chart type

    You need to capture the chart instead of adding one..

    How many charts are available on the spreadsheet?? This will also depend on whether or not this is a chart on a sheet or a chart sheet...
    Danny

    Never Think Impossible

    If you find my answer helpful then please add to my reputation

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Oct 2005
    Posts
    20

    Re: Change chart type

    Ok I found the solution.
    Thanks

Posting Permissions

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



Click Here to Expand Forum to Full Width