VBA macros Powerpoint compatibility problem

  • Thread starter Thread starter jean-luc bonnier
  • Start date Start date
J

jean-luc bonnier

We experience problems with Visual Basic macros under Powerpoint

These macros have been developed with Powerpoint 2003 and VBA 6.1. When
executed with this environment, no problem.

Problem is when we execute them on Powerpoint 2007 and VBA 6.1 or 6.3.
Any idea for fixing this comptability problem ?

Extract of VBA code and error code:
ActiveWindow.Close
ActiveWindow.View.Paste
VBA error 80048240 on View.Paste
View (unknown member) : Invalid request. Clipboard is empty or contains data
which may not be pasted here

I've tried to apply what is recommended in
http://support.microsoft.com/default.aspx/kb/285472?p=1
but without success.

I am quite a beginner in VBA and really don't know to debug that.
Let me know if you want to see these macros and I'll send you.

Thanks for your support
Jean-Luc (in HP Grenoble France)
 
Hi,
Have you confirmed what is the active window when you try to paste? Are you
trying to paste on the slide? If you know the location of the paste location
have you tried alternate approached like using
ActivePresentation.Slides(1).Shapes.Paste?


--
Regards,
Shyam Pillai

Handout Wizard: http://skp.mvps.org/how. PowerPoint 2010 (32-bit/64-bit)
versions supported.
 
Thanks for your reply.
The sequence is the following:

ActivePresentation.Slides.Range.Copy
ActiveWindow.Close
ActiveWindow.View.Paste

Paste works on PP2003 and not on PP2007

But this VBA code seem quite obscure to me
Let me know if I can send you the whole code.

Best regards
JLuc Bonnier
 
Hi,
I can repro the problem with your code. The code basically assumes that the
view in which the presentation is in will accept the pasted slides. While
this may have worked in PPT 2003, you need to ensure that the current view
can accept the pasted contents. For example you cannot assume that the
activewindow will accept the contents of the Paste operation.

ActivePresentation.Slides.Range.Copy
ActiveWindow.Close

'Since you wish to paste slides, switch the view to slide sorter or you can
also activate the thumbnail pane
ActiveWindow.ViewType = ppViewSlideSorter

ActiveWindow.View.Paste


--
Regards,
Shyam Pillai

Handout Wizard: http://skp.mvps.org/how.
PowerPoint 2010 (32-bit/64-bit) versions supported.
 
Hello,

As proposed, I added the line
ActiveWindow.ViewType = ppViewSlideSorter
before pasting.

and this fixes my problem on PP2007. I am now able to run properly the
concerned VBA macro.

I plan to run other macros in the short term. Is it possible to find
somewhere the known compatibility VBA issues between PP2003 and PP2007 ?

Many thanks for your efficient support.
Best regards
JLuc Bonnier
 
Back
Top