Anyone had figured out PasteSpecial

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi everyone. Just trying to adapt our app to office 2007, had this piece of
code that worked with all previous versions:

_shape = pptSlide.Shapes.PasteSpecial(10)

There is an excel table on the clip board and this is just pasting it onto a
power point slide as a ppPasteOLEObject. How would one achieve the same
results with office 2007?

Thanks in advance
 
Hi everyone. Just trying to adapt our app to office 2007, had this piece of
code that worked with all previous versions:

_shape = pptSlide.Shapes.PasteSpecial(10)

There is an excel table on the clip board and this is just pasting it onto a
power point slide as a ppPasteOLEObject. How would one achieve the same
results with office 2007?

In VBA you'd do pretty much the same thing:

Dim oSld As Slide
Dim oSh As Shape

Set oSld = ActivePresentation.Slides(1)

' note that PasteSpecial returns a shaperange
' you need to set the shape = the first item in the range
' rather than the range itself else you get a type mismatch error
' In VBA, anyhow.
Set oSh = oSld.Shapes.PasteSpecial(ppPasteMetafilePicture)(1)

But there's something quite buggy about the way Excel puts stuff on the
clipboard. Selecting and copying content then running code like this will
often fail (and if you look manually at the Paste Special options, the only
thing there will be unformatted text, which is why choosing any other option
from code fails.)

Repeat the select and copy from Excel a time or two and suddenly it starts to
work. No idea why.
 
Hi Steve, thanks for your reply. Unfortunately this is not VBA but
vb.net(.net framework 1.x). This used to work like a charm. End result is a
Power Point slide with embeded Excel worksheet. Too bad that does not work
with 2007. I get "Clipboard is empty or can't paste this here". Clipboard
is not empty. Using PasteSpecial(2) /* i think */ I can drop it down as an
image, but emeded worksheet, which is what I need does not happen for some
reason. I guess I have to keep on looking. Can anyone point to a page
containing the whole enumeration for PasteSpecial under thisnew version of
office?

Thanks

Paul
 
Hi Steve, thanks for your reply. Unfortunately this is not VBA but
vb.net(.net framework 1.x).

I figured that. VBA wouldn't have compiled it (wants you to use SET xxx = yyy for
objects rather than xxx = yyy, among other things).
This used to work like a charm.

Welcome to 2007. :-(
End result is a
Power Point slide with embeded Excel worksheet. Too bad that does not work
with 2007. I get "Clipboard is empty or can't paste this here". Clipboard
is not empty.

But what does it contain? As I mentioned, sometimes Excel doesn't always do what
you ask it to or at least do what you'd expect it to when copying. Even if the
clipboard's got all kinds of goodies, you'll still get an error if you ask for
something that's not there.
Using PasteSpecial(2) /* i think */ I can drop it down as an
image, but emeded worksheet, which is what I need does not happen for some
reason. I guess I have to keep on looking. Can anyone point to a page
containing the whole enumeration for PasteSpecial under thisnew version of
office?

Use the Object Browser in PPT. Start the IDE, press F2, search on pppastedatatype

But again, what you ask for has to be on the clipboard already or it won't work.
 
Thanks Steve, I spend about 1 1/2 hours looking for a menu item launching the
IDE in PPT, but I guess the only way to do this now is Alt+F11. I will give
it another try I guess and then I can go to my boss and ask for a whole team
to be assigned to this project.

I have been involved with this app for quite some time. New versions of
office (XP, 2003) were an easy fix for us and usually would involve
overriding couple of functions. This time around, it seems that we have to
re-do all our office interaction and considering that this is pretty much all
our app does, this means lots of work. I am not even going to mention Vista
at this point.

I guess many developers are very busy now.

Thanks for your help
 
Thanks Steve, I spend about 1 1/2 hours looking for a menu item launching the
IDE in PPT, but I guess the only way to do this now is Alt+F11.

That's the easiest, but you can also do OfficeButton, PowerPoint Options, and choose
the option to show Dev tab on ribbon.
I will give
it another try I guess and then I can go to my boss and ask for a whole team
to be assigned to this project.

I have been involved with this app for quite some time. New versions of
office (XP, 2003) were an easy fix for us and usually would involve
overriding couple of functions. This time around, it seems that we have to
re-do all our office interaction and considering that this is pretty much all
our app does, this means lots of work. I am not even going to mention Vista
at this point.

I guess many developers are very busy now.

Seems so ... sigh.
 
Back
Top