Re: copying all charts as enhanced metafiles
- From: "Peter T" <peter_t@discussions>
- Date: Tue, 9 Jun 2009 14:51:56 +0100
What a palava!
Sub test()
Dim i As Long
Dim arr()
Dim wsSource As Work***, wsDest As Work***
Set wsSource = Worksheets("Sheet1")
Set wsDest = Worksheets("Sheet2")
wsSource.Activate
With wsSource.ChartObjects
ReDim arr(1 To .Count)
For i = 1 To UBound(arr)
arr(i) = .Item(i).ZOrder
Next
End With
wsSource.DrawingObjects(arr).Select
wsSource.DrawingObjects(arr).Copy
wsDest.Activate
wsDest.Range("B2").Activate
wsDest.PasteSpecial Format:="Picture (Enhanced Metafile)"
End Sub
Lots of select/activate and other stuff in the above I'd normally be
advising people not to do - but if needs must for Excel 2007 !
Regards,
Peter T
"Paste charts as enchanced metafile"
<Pastechartsasenchancedmetafile@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:734F0956-10A5-4DD2-8FC6-08B8CEFAC384@xxxxxxxxxxxxxxxx
Peter,
.Copy works for a single chart. Any way to select all the charts and paste
them all at once?
"Peter T" wrote:
CopyPicture doesn't work correctly in Excel 2007, it has been reported.
Just use .Copy and all formats will be copied to the clipboard, then
paste
with whichever format you want. More here -
http://groups.google.co.uk/group/microsoft.public.excel.programming/browse_frm/thread/67b778e08fb2e7a/b5536ac8340331af?lnk=gst&q=copypicture+peter-t#b5536ac8340331af
Regards,
Peter T
"Paste charts as enchanced metafile"
<Pastechartsasenchancedmetafile@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message
news:42E0EFA6-38D8-4BA0-AAC1-C1564BF007BC@xxxxxxxxxxxxxxxx
I should add the loss of resolution is in Excel2007 and the error in the
second code is also in Excel2007. Both methods work fine in Excel2003.
"Paste charts as enchanced metafile" wrote:
I have a *** with a number of charts. I want to copy them to another
***
as a single picture. The following code works, but the picture loses
resolution.
'Copies graphs as picture
Sheets("Graphs").Select
Range("A1:R51").Select
Selection.CopyPicture Appearance:=xlScreen, Format:=xlPicture
Range("A1").Select
'Pastes graph picture to summary ***
Sheets("Static Summary Sheet").Select
Range("A1").Select
Active***.Paste
I have replaced the code with:
'Copies graphs as picture
Sheets("Graphs").Select
Active***.Shapes.SelectAll
Selection.Copy
Range("A1").Select
'Pastes graph picture to summary ***
Sheets("Static Summary Sheet").Select
Range("D5").Select
Active***.PasteSpecial Format:="Picture (Enhanced Metafile)",
Link:=False _
, DisplayAsIcon:=False
Selection.Top = 69.75
Selection.Left = 37.5
Now I get an error in the pastespecial line "PasteSpecial method of
Work*** class failed.
Any ideas?
.
- Follow-Ups:
- Re: copying all charts as enhanced metafiles
- From: Paste charts as enchanced metafile
- Re: copying all charts as enhanced metafiles
- References:
- copying all charts as enhanced metafiles
- From: Paste charts as enchanced metafile
- RE: copying all charts as enhanced metafiles
- From: Paste charts as enchanced metafile
- Re: copying all charts as enhanced metafiles
- From: Peter T
- Re: copying all charts as enhanced metafiles
- From: Paste charts as enchanced metafile
- copying all charts as enhanced metafiles
- Prev by Date: Re: Calculating and multiplying ratios
- Next by Date: Re: Open Text Files/Format/Save as .xls for multiple files.
- Previous by thread: Re: copying all charts as enhanced metafiles
- Next by thread: Re: copying all charts as enhanced metafiles
- Index(es):