Benno Savioli
asked on
export EXCEL-charts programmatically in 'Picture'- format
I know the options to export a chart via VBA in GIF or JPG - but the quality of this often is not as good as when choosing [shift]+[edit] - [copy picture] - appearance/size =as shown on screen and pasting it.
I'm wondering if there is a way to export the chart into the same format (i guess it is wmf or emf) that EXCEL uses internally for the above described copy-paste mechanism
I was already looking wild around for hours but I didn't find a proper solution so far - I presume I have to go over the clipboard object with API-calls etc. - that's beyond my semi-professional/amateur status
Thanks for a good working proposal
I'm wondering if there is a way to export the chart into the same format (i guess it is wmf or emf) that EXCEL uses internally for the above described copy-paste mechanism
I was already looking wild around for hours but I didn't find a proper solution so far - I presume I have to go over the clipboard object with API-calls etc. - that's beyond my semi-professional/amateur status
Thanks for a good working proposal
ASKER
Thanks for the hint - but what I'm actually looking for is really a way for programatically (VBA) exporting into a file-format that is like the one used within copy-paste - I don't want to use a third party tool but to have a code to save from the clipboard into the graphic-file. Copy to the clipboard I can do via standard VBA - so the second step: identifying in and storing from clipboard is the critical point
Best regards
Benno
Best regards
Benno
Lets talk more.
First what version of excel?
Second, I wrote some code to copy the picture, but what do you want to do next, save it to a file or paste it into excel or another office application?
First what version of excel?
Second, I wrote some code to copy the picture, but what do you want to do next, save it to a file or paste it into excel or another office application?
ASKER
Hi Weinberk
Currently I'm still with EXCEL 2000 but I'm preparing to move to 2007 - nonetheless I'd prefer to have a solution that is not related to the newest Office version alone but more general.
In meantime I found codes that refer to manipulate the ClipBoard via API, but they all demonstrate only GetText or SetText.
Copy the chart programmatically to ClipBoard I know how to do with on-board tools of VBA as it is directly supported (as is the direct paste too)
What I wish to have is
1. something like 'GetPicture' from the clipboard and
2. Save this to file as *.emf or *.wmf with a file-name and path specified by me
Hope this is suffciciently clear
Best regards
Benno
Currently I'm still with EXCEL 2000 but I'm preparing to move to 2007 - nonetheless I'd prefer to have a solution that is not related to the newest Office version alone but more general.
In meantime I found codes that refer to manipulate the ClipBoard via API, but they all demonstrate only GetText or SetText.
Copy the chart programmatically to ClipBoard I know how to do with on-board tools of VBA as it is directly supported (as is the direct paste too)
What I wish to have is
1. something like 'GetPicture' from the clipboard and
2. Save this to file as *.emf or *.wmf with a file-name and path specified by me
Hope this is suffciciently clear
Best regards
Benno
This VBA code will get you the image to the clipboard:
ActiveSheet.ChartObjects(" Chart 1").Activate
ActiveChart.ChartArea.Sele ct
ActiveChart.CopyPicture Appearance:=xlScreen, Size:=xlScreen, Format:= xlPicture
This is in Excel 2003, but it should work equally well in 2000.
I still think that you're going to be hard pressed to find a built in solution that will save the clipboard to a wmf or emf file.
This post (old) http://groups.google.ca/gr oup/micros oft.public .access.mo dulesdaovb a/browse_t hread/thre ad/674742b 64c6e7d01/ 3e95e8f696 986245?lnk =st&q=getc lipboardda ta(cf_bitm ap)+visual +basic&rnu m=2#3e95e8 f696986245 has info on saving the clipboard to a bitmap.
Have you considered the possibility of printing to a postscript file?
Or how about using a picture object and pasting from the clipboard. Something like this
first copy to the clipboard as I showed in the previous post
then
Dim TheImageData As DataObject
Set TheImageData = New DataObject
TheImageData.GetFromClipbo ard
That'll get the metafile into the data object. I don't know how to get the DataObject into the picture control. If you can figure that out, maybe the SavePicture function can then be used? That might only be gif,jpg, etc again though. Worth a shot.
ActiveSheet.ChartObjects("
ActiveChart.ChartArea.Sele
ActiveChart.CopyPicture Appearance:=xlScreen, Size:=xlScreen, Format:= xlPicture
This is in Excel 2003, but it should work equally well in 2000.
I still think that you're going to be hard pressed to find a built in solution that will save the clipboard to a wmf or emf file.
This post (old) http://groups.google.ca/gr
Have you considered the possibility of printing to a postscript file?
Or how about using a picture object and pasting from the clipboard. Something like this
first copy to the clipboard as I showed in the previous post
then
Dim TheImageData As DataObject
Set TheImageData = New DataObject
TheImageData.GetFromClipbo
That'll get the metafile into the data object. I don't know how to get the DataObject into the picture control. If you can figure that out, maybe the SavePicture function can then be used? That might only be gif,jpg, etc again though. Worth a shot.
ASKER
I have no objection as I didn't receive a solution matching my question - I made a workaround for myself that is ok for the direct context of use but not what I had in mind
Sorry for not closing myself the topic earlier
best regards
Benno
Sorry for not closing myself the topic earlier
best regards
Benno
So post your solution for others to find.
I no way to know you didn't get a solution or that my suggestions didn't help since you didn't reply.
I no way to know you didn't get a solution or that my suggestions didn't help since you didn't reply.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
There's a program http://www.asap-utilities.
It appears to be free for non-commercial use.