+ Reply to Thread
Results 1 to 10 of 10

Save excel chart

  1. #1
    Stevie D
    Guest

    Save excel chart

    Hi I have two related questions,

    1) Is it possible to select an excel chart and save it as a separate object
    that is that independent of the workbook it was created in?

    2) Assuming this can be done - can I use VBA to overwrite this file when the
    underlying data source changes?

    Thanks,

    Steve



  2. #2
    Don Guillett
    Guest

    Re: Save excel chart

    One way
    Sub ExportChartJPG()
    ActiveChart.Export Filename:="C:\a\MyChart.jpg", _
    FilterName:="jpeg"
    End Sub

    --
    Don Guillett
    SalesAid Software
    donaldb@281.com
    "Stevie D" <Steve@127.0.0.1> wrote in message
    news:cvviee$nn9$1@newsg1.svr.pol.co.uk...
    > Hi I have two related questions,
    >
    > 1) Is it possible to select an excel chart and save it as a separate

    object
    > that is that independent of the workbook it was created in?
    >
    > 2) Assuming this can be done - can I use VBA to overwrite this file when

    the
    > underlying data source changes?
    >
    > Thanks,
    >
    > Steve
    >
    >




  3. #3
    Don Guillett
    Guest

    Re: Save excel chart

    Thanks for your private email that it worked for you.

    --
    Don Guillett
    SalesAid Software
    donaldb@281.com
    "Don Guillett" <donaldb@281.com> wrote in message
    news:ej80jgbHFHA.588@TK2MSFTNGP15.phx.gbl...
    > One way
    > Sub ExportChartJPG()
    > ActiveChart.Export Filename:="C:\a\MyChart.jpg", _
    > FilterName:="jpeg"
    > End Sub
    >
    > --
    > Don Guillett
    > SalesAid Software
    > donaldb@281.com
    > "Stevie D" <Steve@127.0.0.1> wrote in message
    > news:cvviee$nn9$1@newsg1.svr.pol.co.uk...
    > > Hi I have two related questions,
    > >
    > > 1) Is it possible to select an excel chart and save it as a separate

    > object
    > > that is that independent of the workbook it was created in?
    > >
    > > 2) Assuming this can be done - can I use VBA to overwrite this file when

    > the
    > > underlying data source changes?
    > >
    > > Thanks,
    > >
    > > Steve
    > >
    > >

    >
    >




  4. #4
    crossingmind
    Guest

    Re: Save excel chart

    Hi Don, I got this question after reading your help. Do you think it
    is possible to save charts to illustrator file format as a seperate
    file? Thank you in advance!


  5. #5
    Don Guillett
    Guest

    Re: Save excel chart

    try it. Just change the extensions.

    --
    Don Guillett
    SalesAid Software
    donaldb@281.com
    "crossingmind" <laetitiazx@yahoo.com> wrote in message
    news:1109625051.957271.118440@o13g2000cwo.googlegroups.com...
    > Hi Don, I got this question after reading your help. Do you think it
    > is possible to save charts to illustrator file format as a seperate
    > file? Thank you in advance!
    >




  6. #6
    crossingmind
    Guest

    Re: Save excel chart

    Sub ExportChartAI()
    ActiveChart.Export Filename:="C:\a\MyChart.ai", _
    FilterName:="ai"
    End Sub

    Hi Don, thanks for your reply. I tried this code, but it kept telling
    me

    ActiveChart.Export Filename:="C:\a\MyChart.ai", _
    FilterName:="ai"

    needs debug. Could you help take a look? Thank you again!


  7. #7
    Herbert Chan
    Guest

    Re: Save excel chart

    I think Excel only supports exports to jpg and gif.

    "crossingmind" <laetitiazx@yahoo.com> ¦b¶l¥ó
    news:1109697696.713666.229480@l41g2000cwc.googlegroups.com ¤¤¼¶¼g...
    > Sub ExportChartAI()
    > ActiveChart.Export Filename:="C:\a\MyChart.ai", _
    > FilterName:="ai"
    > End Sub
    >
    > Hi Don, thanks for your reply. I tried this code, but it kept telling
    > me
    >
    > ActiveChart.Export Filename:="C:\a\MyChart.ai", _
    > FilterName:="ai"
    >
    > needs debug. Could you help take a look? Thank you again!
    >




  8. #8
    Jon Peltier
    Guest

    Re: Save excel chart

    Herbert and others -

    Excel supports jpg, gif, png, and tif. I recall mixed results with bmp, but you
    don't need it if you have gif and png. Avoid jpg, which is not optimized for this
    kind of graphic.

    Excel does not support ai or eps. I have been hunting for an eps export solution,
    and the best I can find (which I haven't tested) is to install a postscript printer
    driver, locate the chart on its own chart sheet, adjust the margins so the chart is
    the right size (the margins may be >3" on the sides and >2.5" top and bottom), and
    print the chart sheet to a file using this driver. This produces a ps file, but it's
    apparently interchangeable (or mostly so) with eps.

    - Jon
    -------
    Jon Peltier, Microsoft Excel MVP
    Peltier Technical Services
    Tutorials and Custom Solutions
    http://PeltierTech.com/
    _______

    Herbert Chan wrote:

    > I think Excel only supports exports to jpg and gif.
    >
    > "crossingmind" <laetitiazx@yahoo.com> ¦b¶l¥ó
    > news:1109697696.713666.229480@l41g2000cwc.googlegroups.com ¤¤¼¶¼g...
    >
    >>Sub ExportChartAI()
    >>ActiveChart.Export Filename:="C:\a\MyChart.ai", _
    >> FilterName:="ai"
    >>End Sub
    >>
    >>Hi Don, thanks for your reply. I tried this code, but it kept telling
    >>me
    >>
    >>ActiveChart.Export Filename:="C:\a\MyChart.ai", _
    >> FilterName:="ai"
    >>
    >>needs debug. Could you help take a look? Thank you again!
    >>

    >
    >
    >



  9. #9
    john.opie@gmail.com
    Guest

    Re: Save excel chart

    Hi -

    1) Yes. This takes a moment to explain, but it's doable.

    In this code snippet, we have a ChartArchiveBook that simply holds a
    large number of charts in WMF/EMF format. It assumes that you have
    already selected the chart.

    With ActiveChart
    .ChartArea.Select
    .CopyPicture Appearance:=xlPrinter, Size:=xlScreen,
    Format:=xlPicture
    End With
    '
    ' First name the graph so we can find it again, and put it where we
    can see it...
    '
    GraphName = "WhateverYouWantItToBe"

    ' The following pastes to the proper format and to the proper place.
    You can fiddle with the range...
    '
    With Workbooks(IndustryAnalyseBook).Sheets(AnalyseBookSheetName)
    .Activate
    .Range("A1").Select
    .PasteSpecial Format:="Bild (Extended Metafile)",
    Link:=False, _ DisplayAsIcon:=False
    End With
    With Selection.ShapeRange
    .Parent.Name = GraphName
    .Height = 500
    .Width = 232
    End With

    The latter code simply places it in cell A1 and gives it the size of
    500 by 232 pixels, you'll want to change that.

    2) This took a long time to figure out, but it works great:

    For Each MyShape In
    Workbooks("TargetWorkbook").Sheets("TargetWorksheet").Shapes
    If MyShape.Name = GraphName Then MyShape.Delete
    Next MyShape

    These code snippets are part of a very large system, so they might not
    be completely understandable: let me know if you need further
    explanation...

    John

    PS: some of the code wraps funny here...you'll need to play with it to
    get it working right...


  10. #10
    john.opie@gmail.com
    Guest

    Re: Save excel chart

    Darn, forgot to neutralize this code:

    With Workbooks("TargetWorkbook").Sheets("TargetWorksheet")
    .Activate
    .Range("A1").Select
    .PasteSpecial Format:="Bild (Extended Metafile)",
    Link:=False, _ DisplayAsIcon:=False
    End With
    With Selection.ShapeRange
    .Parent.Name = GraphName
    .Height = 500
    .Width = 232
    End With

    So, now that should be clearer...

    John


+ 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