Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 04-14-2012, 12:12 AM
JohnWilson JohnWilson is offline How do you identify the ID of a picture in PowerPoint? Windows 7 64bit How do you identify the ID of a picture in PowerPoint? Office 2010 32bit
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,914
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

PowerPoint vba doesn't really offer a convenient way to use ID like that.

The best solution is to write a custom function

Code:
Function ShapeByID(ThisSlide As Slide, ThisID As Long) As Shape
For Each ShapeByID In ThisSlide.Shapes
If ShapeByID.Id = ThisID Then
Exit Function
End If
Next
End Function
And an example of how to use to delete shape with ID=8 from slide 1

Code:
Sub exampleID()
On Error Resume Next
ShapeByID(ThisSlide:=ActivePresentation.Slides(1), ThisID:=8).Delete
End Sub
An easier solution is to use the selection pane to rename using unique names then ....

Code:
Sub DeleteByName()
On Error Resume Next ' in case shape doesn't exist
ActivePresentation.Slides(1).Shapes("MyName").Delete
End Sub
__________________
Microsoft PowerPoint MVP 2007-2023
Free Advanced PowerPoint Tips and Tutorials

Last edited by JohnWilson; 04-14-2012 at 06:38 AM.
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Powerpoint automatically changing picture size when adding a picture (2010) One_Life PowerPoint 7 01-20-2012 06:57 AM
How do you identify the ID of a picture in PowerPoint? Picture size for Powerpoint roligan PowerPoint 2 12-22-2011 07:18 AM
How do you identify the ID of a picture in PowerPoint? Changing opacity of a picture on powerpoint Straitsfan PowerPoint 1 05-18-2011 10:30 AM
How do you identify the ID of a picture in PowerPoint? How to identify the paragraph number you are on SaneMan Word VBA 1 05-18-2011 05:43 AM
PowerPoint 2003 - Change default location for Insert Picture Fee PowerPoint 0 05-12-2011 02:15 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:37 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2026 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft