Office 2003 macro won't run in Office 2007

N

Nickis

I created a macro in Office 2003 using early binding to copy data from Excel
into Powerpoint...not the greatest code...but it works! Now my users are
switching to Office 2007 and the code won't run! I have include the relevant
string of code below.

Dim objPPT As Object
Set objPPT = CreateObject("PowerPoint.Application")
objPPT.Visible = True

Dim PPApp As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide

Set PPApp = GetObject(, "Powerpoint.Application")
PPApp.ActivePresentation.Slides.range(Array(13)).Select

' Reference active presentation
Set PPPres = PPApp.ActivePresentation
PPApp.ActiveWindow.ViewType = ppViewSlide
' Reference active slide
Set PPSlide =
PPPres.Slides(PPApp.ActiveWindow.Selection.SlideRange.SlideIndex)

'EXCEL CODE
Sheets("TablesforPP").Select
range("a2").Select
Selection.Copy

'POWERPOINT CODE
PPSlide.Shapes.Paste.Select

This is where it errors with the following message:

"Run-time error '-2147188160(80048240)':
Shapes (unknown member): Invalid request. Clipboard is empty or contains
data which may not be pasted here"

I don't need this coding to be compatible with both Office 2003 and 2007, I
just need it to work in Office 2007. I'm sure I will run into more issues as
I cycle through the code, but if I can understand why this is happening and
fix it, I think I'll be a long way to understanding any subsequent issues.

Thanks,
Nicki
 
N

Nickis

joel said:
Check if the cells in the workbook are selected to see if the problem si
in excel or powerpoint. I wouldmake the following change

from
'EXCEL CODE
Sheets("TablesforPP").Select
range("a2").Select
Selection.Copy


to
with Thisworkbook
'EXCEL CODE
.Sheets("TablesforPP").range("a2").Copy
end with


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/showthread.php?t=170126

Microsoft Office Help

.
Sorry....yes I should have stated that the cell in Excel IS selected. The problem is in the paste to Powerpoint.

Nicki
 
N

Nickis

No...that's not it.

I can manually paste...and can paste special. I'm thinking it's something
to do with the code and how Powerpoint is treating the "shape". Not sure
what the code is to "pastespecial" in powerpoint. My "shape" looks more like
I would expect when I paste special in "Formatted Text (RTF)" but I'm not
sure of the Powerpoint code to perform this, and the macro recorder in 2003
doesn't help (there is no macro recorder in Powerpoint 2007!).

Maybe if I search/post over on the Powerpoint site I might get some insight?

Nicki
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top