PC Review


Reply
Thread Tools Rate Thread

Copy multiple charts to an array?

 
 
shelfish
Guest
Posts: n/a
 
      6th May 2008
Ok, I've searched this group for while and cannot find any solution to
this so here goes...

Please ignore syntax errors as this is strongly paraphrased from the
actual code. I'm just looking for a way to accomplish the
objective....
********************************************************************************
Dim PictureArray as variant = Array(chart1, chart2, chart3....)
Dim elementCount as int = PictureArray.Elements.count
Dim i

'COPY EXCEL CHARTS TO ARRAY AS PICTURES
For i = 1 To elementCount

With PictureArray(i)
.Select
[some code removed]

'COPY CHART AS PICTURE
PictureArray(i) = .CopyPicture(Appearance:=xlScreen,
Size:=xlScreen, Format:=xlPicture)

End With
Next

'START POWERPOINT
Set PPApp =
CreateObject("PowerPoint.Application")
PPApp.Visible = True

'NEW PRESENTATION
Set PPPres = PPApp.Presentations.Add

[more code removed]

'ADD NEW SLIDE TO THE END
SlideCount = PPPres.Slides.Count
Set PPSlide = PPPres.Slides.Add(SlideCount + 1,
ppLayoutTitleOnly)
PPApp.ActiveWindow.View.GotoSlide PPSlide.SlideIndex


'PASTE PICTURE ARRAY ELEMENTS
For i = 1 To elementCount
With PPSlide

'PASTE IMAGE FROM ARRAY
On Error Resume Next
.Shapes.Paste (copyPasteArray(i))
.Shapes(i + 1).Select

End With
Next
*****************************************************************************************

This last part just pastes the last item copied to the clip board. So
the question is, how do I do all the copying and then all the
pasting.

Many thanks for any assistance offered.

S.
 
Reply With Quote
 
 
 
 
Jon Peltier
Guest
Posts: n/a
 
      6th May 2008
You have to loop through the list of charts, and in each loop, copy one
chart, then paste it, then in the next loop, copy another chart, then paste
it.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"shelfish" <(E-Mail Removed)> wrote in message
news:8b73990c-bec1-4626-bf9d-(E-Mail Removed)...
> Ok, I've searched this group for while and cannot find any solution to
> this so here goes...
>
> Please ignore syntax errors as this is strongly paraphrased from the
> actual code. I'm just looking for a way to accomplish the
> objective....
> ********************************************************************************
> Dim PictureArray as variant = Array(chart1, chart2, chart3....)
> Dim elementCount as int = PictureArray.Elements.count
> Dim i
>
> 'COPY EXCEL CHARTS TO ARRAY AS PICTURES
> For i = 1 To elementCount
>
> With PictureArray(i)
> .Select
> [some code removed]
>
> 'COPY CHART AS PICTURE
> PictureArray(i) = .CopyPicture(Appearance:=xlScreen,
> Size:=xlScreen, Format:=xlPicture)
>
> End With
> Next
>
> 'START POWERPOINT
> Set PPApp =
> CreateObject("PowerPoint.Application")
> PPApp.Visible = True
>
> 'NEW PRESENTATION
> Set PPPres = PPApp.Presentations.Add
>
> [more code removed]
>
> 'ADD NEW SLIDE TO THE END
> SlideCount = PPPres.Slides.Count
> Set PPSlide = PPPres.Slides.Add(SlideCount + 1,
> ppLayoutTitleOnly)
> PPApp.ActiveWindow.View.GotoSlide PPSlide.SlideIndex
>
>
> 'PASTE PICTURE ARRAY ELEMENTS
> For i = 1 To elementCount
> With PPSlide
>
> 'PASTE IMAGE FROM ARRAY
> On Error Resume Next
> .Shapes.Paste (copyPasteArray(i))
> .Shapes(i + 1).Select
>
> End With
> Next
> *****************************************************************************************
>
> This last part just pastes the last item copied to the clip board. So
> the question is, how do I do all the copying and then all the
> pasting.
>
> Many thanks for any assistance offered.
>
> S.



 
Reply With Quote
 
shelfish
Guest
Posts: n/a
 
      6th May 2008
Damn it! I thought that might be the answer, I just didn't want to
admit it. This will require some serious rework. Thanks for the answer
just the same.

S.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy/Paste Charts; Define Destination of Charts in PowerPoint ryguy7272 Microsoft Excel Programming 2 24th Jan 2008 08:04 PM
Charts - How to have multiple charts share a legend. =?Utf-8?B?U2Vhbg==?= Microsoft Excel Charting 2 20th Nov 2007 04:49 AM
select variables ranges, copy to array, paste the array in new workbook Mathew Microsoft Excel Worksheet Functions 1 1st Apr 2005 09:40 AM
Copy multiple charts from Excel to Power Point =?Utf-8?B?R2VuZWY=?= Microsoft Excel Charting 1 2nd Mar 2005 01:25 AM
Copy multiple charts MarkyP Microsoft Excel Charting 1 2nd Jul 2003 12:19 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:28 AM.