PC Review


Reply
Thread Tools Rate Thread

How do i find if a shape "xyz" is on Selected slide with vba

 
 
Chuck [Sbc\)
Guest
Posts: n/a
 
      14th May 2007
I am using a macro which scans all of the slides in a presentation to make
changes to a given shape (Named). I would like to know if the selected
slide contains a shape (textbox) with the name of "xyz" If it does, I want
to skip that slide.


 
Reply With Quote
 
 
 
 
Steve Rindsberg
Guest
Posts: n/a
 
      14th May 2007
In article <Pr22i.21497$(E-Mail Removed)>, Chuck [Sbc)
wrote:
> I am using a macro which scans all of the slides in a presentation to make
> changes to a given shape (Named). I would like to know if the selected
> slide contains a shape (textbox) with the name of "xyz" If it does, I want
> to skip that slide.


One simple way is to call a function that finds the shape on the slide, if it
exists. It's probably more generally useful than just testing to see if the
shape exists or not; you may want to do something with the shape in other
macros, and the same function can be used to get the shape and work with it.

Say you're in a loop like:

Dim oSl as Slide
Dim oSh as Shape

For each oSl in ActivePresentation.Slides
Set oSh = GetShape(oSl, "xyz") Then
If oSh Is Nothing Then ' no shape by that name
' do your stuff here
End If
Next ' oSl

Function GetShape(oSl as Slide, sShapeName as String) as Shape
' Returns the shape named sShapeName on oSl
' or nothing if the shape doesn't exist
On Error Resume Next
Set GetShape = oSl.Shapes(sShapeName)
End Function


-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================


 
Reply With Quote
 
Chuck [Sbc\)
Guest
Posts: n/a
 
      16th May 2007
Thanks - Worked just right,


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HELP!!! "find now" is changing my view from "day/week/month" to"Active Appointments" johng34 Microsoft Outlook Calendar 1 12th Jun 2009 03:31 AM
Search unable to find Word documents when "Document" type selected Kristan M. Kenney [MVP] Windows Vista File Management 0 29th Nov 2007 12:38 PM
HELP on "left","right","find","len","substitute" functions serene83 Microsoft Excel Misc 5 27th Jun 2006 02:23 AM
Auto-select "relative to slide" when only one object selected =?Utf-8?B?UGV0ZXJzb25PSEk=?= Microsoft Powerpoint 2 4th Apr 2005 10:47 PM
Pasting selected text into the "Find" dialogue box Sylvester Vital Microsoft Word Document Management 4 8th Nov 2003 04:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:11 AM.