Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Sydney, Australia, New South Wales, Australia
    Posts
    251
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Export chart as JPG options (2000)

    I want to export an Excel chart image as a JPG. I can do this easily with the following code:

    <pre>Worksheets("Sheet1").ChartObjects(1) _
    .Chart.Export _
    Filename:="current_sales.jpg", FilterName:="JPG"
    </pre>


    This works a treat.
    My problem is, I want to be able to tweak the JPG save quality. If I use the Interactive:=True option which should 'display the dialog box that contains the filter-specific options', no dialog box is displayed (and anyway, even if it was, I'd want to control those properties programmatically).
    Does anyone know how I can send that value to the filter?
    Perhaps the normal chart-to-jpg filter doesn't support any options. Does anyone know of other filters I could use that would achieve this?
    Thanks in advance for all your help.
    Peter

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

    Re: Export chart as JPG options (2000)

    I would try exporting to .png format instead. For standard charts, you will get better quality at lower file size than .jpg. A.gif will probably also be better than .jpg.

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Sydney, Australia, New South Wales, Australia
    Posts
    251
    Thanks
    0
    Thanked 4 Times in 4 Posts

    Re: Export chart as JPG options (2000)

    True, PNG or GIF would be better for a real chart.
    Trick is, I'm using the chart export to convert a BMP image to JPG. The easiest way for me to do this from VBA is to create an empty Excel chart, insert a picture (a photograph) into the empty-chart wrapper and then export the chart. It works a treat. Because what I'm really exporting is a photo, JPG's probably the best choice.
    But I want to be able to tune the compression!
    Peter

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

    Re: Export chart as JPG options (2000)

    2JPEG is an application with a command-line interface that can be called from another application to create .jpg files; it is fully configurable with command line options. Not cheap, though.

  5. #5
    3 Star Lounger
    Join Date
    Feb 2003
    Location
    Runcorn, Cheshire, United Kingdom
    Posts
    372
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: Export chart as JPG options (2000)

    You can also try Irfan View . Free (for non commercial use; $10 for single user commercial license) and can be run from the command line - in VBA create a text batchfile specifying the control commands and use the shell() command to run it.

Posting Permissions

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