Paste Special Issues

N

Nirmalya

I have a PowerPoint Presentation with linked objects (Excel charts). I
am trying to write a macro that uses Paste Special to make a copy of a
slide and paste it as a metafile in another slide in the same
presentation. Anyone with any ideas on how to go about it?
Also for some strange reason, I am not getting the Run option for my
macros.
Any help in this matter will be appreciated.

Nirmalya.
 
S

Steve Rindsberg

Nirmalya said:
I have a PowerPoint Presentation with linked objects (Excel charts). I
am trying to write a macro that uses Paste Special to make a copy of a
slide and paste it as a metafile in another slide in the same
presentation. Anyone with any ideas on how to go about it?

What have you got so far, and what version of PPT are you using?
You can't control the paste special format in anything but 2003.

On the other hand if you copy/paste the shape then ungroup and regroup it, you
break the link and end up with a metafile. And that'll work in all versions.
Also for some strange reason, I am not getting the Run option for my
macros.

Again, post an example. It might be as simple as the subroutines being
declared like:

Private Sub Whatsit()

ves

Sub Whatsit()
or
Public Sub Whatsit()
 
N

Nirmalya

Steve,
I am using Office 2003. Here is the code:

Private Sub CommandButton1_Click()
ActivePresentation.Slides(1).Shapes.SelectAll
ActiveWindow.Selection.Copy
ActivePresentation.Slides(2).PasteSpecial DataType:=ppPasteGIF, _
DisplayAsIcon:=msoTrue, IconLabel:="Last Month"
End Sub

When I try to run the macro, it gives me a compilation error:
Method or data member not found.
The debugger highlights the .PastSpecial part of
ActivePresentation.Slides(2).PasteSpecial

As for running the macro, I forgot to put it in the Slide Show mode. So
ignore my second query. Thanks for all your help.

Nirmalya.
 
N

Nirmalya

Hey everyone,
I am trying to paste special some linked objects from slide 1 to slide
2 as gif files. I am on Office 2003.
The final updated version of my code as it stands:

Private Sub CommandButton1_Click()
ActivePresentation.Slides(1).Shapes.SelectAll
ActiveSelection.Copy
ActivePresentation.Slides(2).Select
ActiveWindow.View.PasteSpecial DataType:=ppPasteGIF, _
DisplayAsIcon:=msoTrue, IconLabel:="Last Month"
End Sub

I am getting a run-time error. Error msg -
Shape (Unknown member): Invalid request. The window must be in slide or
notes view.

I am at a blank here. Any help will be appreciated.

Regards,
Nirmalya.
 
S

Steve Rindsberg

Nirmalya said:
Steve,
I am using Office 2003. Here is the code:

Private Sub CommandButton1_Click()
ActivePresentation.Slides(1).Shapes.SelectAll
ActiveWindow.Selection.Copy
ActivePresentation.Slides(2).PasteSpecial DataType:=ppPasteGIF, _
DisplayAsIcon:=msoTrue, IconLabel:="Last Month"

Change the line above to:
ActivePresentation.Slides(2).Shapes.PasteSpecial etc etc

and it should work. Not in slide show view, though. You can't select anything
there.

Instead, try:

With ActivePresentation
.Slides(1).Shapes.Range.Copy
.Slides(2).Shapes.PasteSpecial _
DataType:=ppPasteGIF, _
DisplayAsIcon:=msoTrue, _
IconLabel:="Last Month"
End With
 
N

Nirmalya

Steve,
I really appreciate your help. This block was the game-winner for me.
With ActivePresentation
.Slides(1).Shapes.Range.Copy
.Slides(2).Shapes.PasteSpecial _
DataType:=ppPasteGIF, _
DisplayAsIcon:=msoTrue, _
IconLabel:="Last Month"
End With

I think my code didn't work because I wouldn't call the Shapes object
in the PasteSpecial method. Now, I have a working template for future
reference. Thanks once again.

Regards,
Nirmalya.
 
S

Steve Rindsberg

Nirmalya,

Your explanation of the problem is correct. Your original code was trying, in
effect, to paste shapes into the Slides collection instead of the Shapes
collection of a particular slide.
 

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