Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-12-2012, 12:07 PM
Colin Legg's Avatar
Colin Legg Colin Legg is offline Making VBA select chart and then export as picture Windows 7 32bit Making VBA select chart and then export as picture Office 2010 32bit
Expert
 
Join Date: Jan 2011
Location: UK
Posts: 369
Colin Legg will become famous soon enough
Default

So it's the chart class, not the chartobject class which has an export method. This worked fine for me (I set up a chart before running the code):



Code:
Sub foo()
    Dim cto As ChartObject
    Dim cht As Chart
    
    'get a reference to the chartobject on the sheet
    Set cto = Sheet1.ChartObjects(1)
    
    'get a reference to the chart
    Set cht = cto.Chart
    
    'export the chart as a jpg
    cht.Export "C:\Temp\MyChartPic.jpg", "JPG"
    
End Sub
Reply With Quote
  #2  
Old 10-28-2012, 07:53 PM
omahadivision omahadivision is offline Making VBA select chart and then export as picture Windows 7 32bit Making VBA select chart and then export as picture Office 2007
Novice
Making VBA select chart and then export as picture
 
Join Date: Oct 2012
Posts: 28
omahadivision is on a distinguished road
Default

Thanks! It works now! Sorry about the delay; I honestly lost the link

-Dave
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA code to group picture to export as one RenaatS PowerPoint 3 03-05-2012 12:40 PM
Export resource custom field to excel chart jtorres Project 0 03-15-2011 05:16 AM
Can't select or edit chart data itguy PowerPoint 2 09-19-2010 10:13 AM
Making a bar chart with several data entries Blondie1966 PowerPoint 2 04-28-2010 03:00 PM
How To Export A Picture From Word? abrogard Drawing and Graphics 0 08-10-2009 06:27 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:00 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft