Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.charting
|
|||
|
|||
![]()
Hello,
I've successfully been exporting a series of dynamically generated charts from Excel to GIF (I'm programming in VSTO) using code like: Me.Application.ActiveChart.Export("C:\mygraph.gif" ,"GIF") I now need to export these same charts to EMF or WMF so that they can be imported into Word and printed in high quality documents. I've been trying the following, but with no luck: Me.Application.ActiveChart.CopyPicture(Excel.XlPic tureAppearance.xlScreen, Excel.XlCopyPictureFormat.xlPicture, Excel.XlPictureAppearance.xlScreen) Dim d As IDataObject = Clipboard.GetDataObject() If (d.GetDataPresent(DataFormats.EnhancedMetafile)) Then Dim pictBox1 As Image pictBox1 = d.GetData(DataFormats.EnhancedMetafile) pictBox1.Save("C:\mygraph.emf") End If Which dies with the error: Object reference not set to an instance of an object. The more I read, the more I feel like I'm nowhere close to the solution yet. Can anyone point me in the right direction? Any help appreciated. Thanks Todd |
#2
![]()
Posted to microsoft.public.excel.charting
|
|||
|
|||
![]()
You could cut out the intermediate file, and simply copy the chart as a
picture in Excel and paste it into Word. I don't know the funky VSTO for it, but in VBA it's pretty easy. http://peltiertech.com/Excel/XL_PPT.html - Jon ------- Jon Peltier, Microsoft Excel MVP Tutorials and Custom Solutions http://PeltierTech.com _______ "Todd Garrison" wrote in message ... Hello, I've successfully been exporting a series of dynamically generated charts from Excel to GIF (I'm programming in VSTO) using code like: Me.Application.ActiveChart.Export("C:\mygraph.gif" ,"GIF") I now need to export these same charts to EMF or WMF so that they can be imported into Word and printed in high quality documents. I've been trying the following, but with no luck: Me.Application.ActiveChart.CopyPicture(Excel.XlPic tureAppearance.xlScreen, Excel.XlCopyPictureFormat.xlPicture, Excel.XlPictureAppearance.xlScreen) Dim d As IDataObject = Clipboard.GetDataObject() If (d.GetDataPresent(DataFormats.EnhancedMetafile)) Then Dim pictBox1 As Image pictBox1 = d.GetData(DataFormats.EnhancedMetafile) pictBox1.Save("C:\mygraph.emf") End If Which dies with the error: Object reference not set to an instance of an object. The more I read, the more I feel like I'm nowhere close to the solution yet. Can anyone point me in the right direction? Any help appreciated. Thanks Todd |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I save a Word file as an ASCII format? | Excel Discussion (Misc queries) | |||
is it possible to save xls file to a word document like an attachm | Excel Discussion (Misc queries) | |||
default save as file type does not work | Excel Discussion (Misc queries) | |||
Reflecting info between an excel file and a word one or two excel file. | Excel Worksheet Functions | |||
Reflecting info between an excel file and a word one or two excel file. | Links and Linking in Excel |