Hey guys,

After a few tries of my own I thought I should seek enlightment from VB gurus.

I am building an application in VB which purpose is to copy designated charts from Excel and paste them to a PowerPoint presentation. The code is on Excel VB Editor but I do not have a problem to split it and run a separate part on PPT.

I have realised a rough version but it needs some finetunning. What I have done so far is to initiate a the new PPT object, browse through excel's chart objects and copy the appropriate ones and paste them to PPT slide.

My problem is that while i know how to perform the copy-paste routine and I have managed to paste the charts in a designated slide, after the pasting ends I cannot find a way to slect those pasted charts and reposition them as I want because certain slides have 2 or more pasted charts and I cannot find a way to select them and reposition them to the appropriate position within the slide. Only way I can think of it is to select them by coordinates but I would use this solution as a last resorts.

Please share thoughts or suggestions, they are more than welcome.
To skip a future post i have included my code:

Sub test1()
Dim pptApp As PowerPoint.Application
Dim pptPres As PowerPoint.Presentation
Dim pptSlide As PowerPoint.Slide
Dim pptShape As PowerPoint.Shape
Dim i, SlideNum As Integer, strString As String
Dim limit, pathn, objcount, countTables, limitt As Integer
Dim chtobj As ChartObject
Dim ws As Worksheet



Set pptApp = CreateObject("PowerPoint.Application")
pptApp.Visible = True
Set pptPres = pptApp.Presentations.Open("C:\Documents and Settings\Sylvia\Desktop\test\test.ppt")

ActiveWorkbook.Activate

For Each ws In ActiveWorkbook.Worksheets

For Each chtobj In Sheets(ws.Name).ChartObjects
oname = chtobj.Name
If InStr(1, chtobj.Name, "BNChart", vbTextCompare) Then
Sheets(ws.Name).Activate
ActiveSheet.ChartObjects(oname).Activate
ActiveChart.CopyPicture Appearance:=xlScreen, _Size:=xlScreen, Format:=xlPicture

For Each obj In pptPres.Slides

With pptPres.Slides
Set pptSlide = pptPres.Slides(obj.Name)
End With

With pptSlide

For Each pptShape In pptApp.ActiveWindow.Selection.SlideRange.Shapes
If pptSlide.Shapes.Range(pptShape.Name).Name = oname Then
.Shapes.PasteSpecial ppPasteShape
GoTo Holder
End If

Next
End With
Next
End If
Holder: Next
Next

End Sub


Cheers,
Sylvia