PDA

View Full Version : Copy paste data from activerow into existing powerpoint presentation



mgoblue7
03-19-2009, 07:51 AM
Hello all.

I am trying to write a macro which will copy the data in the cells of the active row into an existing powerpoint presentation. I apologize if this is already on another post but I was unable to find anything and to be quite honest I have no idea where to begin.

Like I said, I want to reference the active row of an excel sheet and when the macro is enabled I want to copy and paste the text data in cells A:I of the activerow into corresponding text boxes in a ppt presentation. I want the macro to save the file as the title on the ppt slide (Title(A2)_ECP_Date). I have filled out the ppt with where I would like the text of the cells to go. I'm pretty sure this is doable, yet I have no idea where to begin.

Any help is greatly appreciated. Thank you.

mgoblue7
03-19-2009, 09:43 AM
Spreadsheet with screenshot of ppt.

Bob Phillips
03-19-2009, 10:26 AM
Function PasteRangeIntoPPT()
Const ppViewSlide As Long = 1
Dim mpPPT As Object
Dim mpPres As Object
Dim mpSlide As Object

Set mpPPT = GetObject(, "Powerpoint.Application")

Set mpPres = mpPPT.ActivePresentation

mpPPT.ActiveWindow.ViewType = ppViewSlide

Set mpSlide = mpPres.Slides _
(mpPPT.ActiveWindow.Selection.SlideRange.SlideIndex)

Cells(Activecell.Row, "A").Resize(,9).CopyPicture Appearance:=xlScreen, _
Format:=xlPicture

mpSlide.Shapes.Paste.Select

mpPPT.ActiveWindow.Selection.ShapeRange.Align msoAlignCenters, True
mpPPT.ActiveWindow.Selection.ShapeRange.Align msoAlignMiddles, True

Set mpSlide = Nothing
Set mpPres = Nothing
Set mpPPT = Nothing

End Function

mgoblue7
03-19-2009, 11:43 AM
Thanks for the reply. I want to paste the data(text) from the cells to text in the textboxes. I do not want to copy and paste pictures. Can this be done?

mgoblue7
03-19-2009, 12:53 PM
BTW, I am running Office 2007.