Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General PowerPoint Questions / October 2006

Tip: Looking for answers? Try searching our database.

a way to test if Ungroup is possible?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tony Logan - 03 Oct 2006 23:44 GMT
Is there a way to use code to detect whether an object can be ungrouped or
not?

I'm using a routine that I got from PPTools (www.pptfaq.com) as part of a
larger routine to do some PowerPoint processing via Word. Specifically, I'm
copying as much data as I can from all the shapes on all the slides in a
PowerPoint file, and pasting that data into a Word file.

However, if I add more shape types to the "Case Is" line in the routine
below (msoPlaceHolder is one that's been problematic), and if that particular
shape in my PowerPoint file can't be ungrouped, then the code will throw an
error that stops the routine. It doesn't even go into the error handler to
give me a chance to Resume Next.

So it seems the solution is to perform a test as to whether a particular
shape can be ungrouped or not, and only ungroup it if the test is true. But
if there's a way to do that, I haven't run across it in the Help files or
stumbled upon it while trying various bits of code. Does anyone know if this
is possible?

Here's the routine I mentioned earlier:

Sub EveryShapeOnSlide(oSl As Slide)
' Performs some operation on every shape on a slide

   Dim oSh As Shape
   On Error GoTo ErrorHandler

   For Each oSh In oSl.Shapes
       Select Case oSh.Type
           Case Is = msoEmbeddedOLEObject, msoLinkedOLEObject, msoPicture
               ' Attempting to ungroup a bitmap image causes an error
               ' but no harm is done; we'll ignore it.
               On Error Resume Next
               oSh.Ungroup.Group
               On Error GoTo ErrorHandler
           Case Else
               ' ignore other shape types
       End Select

   Next oSh

NormalExit:
   Exit Sub

ErrorHandler:
   Resume Next

End Sub
Steve Rindsberg - 04 Oct 2006 04:19 GMT
> Is there a way to use code to detect whether an object can be ungrouped or
> not?
[quoted text clipped - 9 lines]
> error that stops the routine. It doesn't even go into the error handler to
> give me a chance to Resume Next.

What specific error do you get?  When you try to ungroup some EPS files, you'll
get a message box telling you that it only contains a bitmap or picture or words
to that effect.  I've not found any way of disabling that one myself.  Is that
what you're seeing?

> So it seems the solution is to perform a test as to whether a particular
> shape can be ungrouped or not, and only ungroup it if the test is true. But
[quoted text clipped - 31 lines]
>
> End Sub

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
Tony Logan - 04 Oct 2006 14:06 GMT
Hi, Steve. The error I get is "Run-time error 70. Permission denied." And
even though I've written an error handler, this error displays the dialog and
brings things to a grinding halt, rather than sending the error to the error
handler.

The line causing this error is:
     oSh.Ungroup.Group

I've tried as many variations on this as I can think up, like
oSh.Ungroup.Select, for instance, but as soon as it gets to that line, the
routine stops.

It almost seems like I need to know whether a shape has the option to be
ungrouped before I make the attempt to ungroup it, but I'm not sure how to do
that in code.

Thanks.

> > Is there a way to use code to detect whether an object can be ungrouped or
> > not?
[quoted text clipped - 56 lines]
> PPTools:  www.pptools.com
> ================================================
Steve Rindsberg - 04 Oct 2006 17:23 GMT
> Hi, Steve. The error I get is "Run-time error 70. Permission denied." And
> even though I've written an error handler, this error displays the dialog and
[quoted text clipped - 7 lines]
> oSh.Ungroup.Select, for instance, but as soon as it gets to that line, the
> routine stops.

Can you send me a one-slide PPT with just one of these objects on it, no more than
that, and also copy/paste our exchange here into the body of the email.  I'd like to
have a look.

steve atsign pptools dirtspeck com

> It almost seems like I need to know whether a shape has the option to be
> ungrouped before I make the attempt to ungroup it, but I'm not sure how to do
[quoted text clipped - 62 lines]
> > PPTools:  www.pptools.com
> > ================================================

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
Tony Logan - 04 Oct 2006 20:09 GMT
Hi, Steve. Sent an email your way.

Thanks.

> Can you send me a one-slide PPT with just one of these objects on it, no more than
> that, and also copy/paste our exchange here into the body of the email.  I'd like to
> have a look.
Steve Rindsberg - 05 Oct 2006 03:30 GMT
> Hi, Steve. Sent an email your way.
>
[quoted text clipped - 3 lines]
> > that, and also copy/paste our exchange here into the body of the email.  I'd like to
> > have a look.

Thanks Tony.

For the benefit of onlookers, the shape in question was an embedded image on the slide
master.  A bit of error trapping seems to have solved the problem at this end.

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.