Consulting

Results 1 to 6 of 6

Thread: Solved: what's wrong with ActiveChart.Export code

  1. #1

    Solved: what's wrong with ActiveChart.Export code

    [VBA]
    Sub ExportChartJPG()
    For i = 1 To Sheets.Count

    ActiveChart.Export Filename:="C:\mycharts\" & Sheets.Name & ".jpg", _
    FilterName:="jpeg"


    Next
    End Sub

    [/VBA]



    hello


    can anyone correct me where i am wrong, what i want to do is, that i want to export my all charts exists on my current sheets export as jpeg or gif" and with the sheet name


    ie. if the sheet name is BOP then filename shouldbe bop.jpg or bop.gif


    thankyou!

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    For i = 1 To Sheets.Count

    Worksheets(i).ChartObjects(1).Chart.Export _
    Filename:="C:\mycharts\" & Worksheets(i).Name & ".jpg", _
    FilterName:="jpeg"

    Next
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3

    r u a champ

    thank u

  4. #4
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    skaswani,
    be sure to mark your thread solved using the thread tools at the top of the page.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  5. #5
    ya, i am about to, just a quick question..

    can i re-size the charts hight & Width??

    thanks

  6. #6
    oh, i m done

    Worksheets(i).ChartObjects(1).Width = 775
    Worksheets(i).ChartObjects(1).Width = 675


    thanks alot 4 helping

Posting Permissions

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