How to check if an object exist or not?

mingyi

New Member
Joined
Feb 18, 2004
Messages
7
Hi,

This is a PowerPoint question. I need to scan through each slide in a presentation to see if each slide contains textbox25. If it's not there, then I need to insert a textbox, and then insert a particular value. I haven't had much success with my codes, any suggestions?

For Each Slide In Application.ActivePresenation.Slides
For i = 1 To Slide.Count
refbox = "Text Box 25"
If ActivePresentation.Slides.Item(1).Shapes.Item(refbox) Is Nothing Then
ActiveWindow.Selection.SlideRange.Shapes.AddTextbox(msoTextOrientationHorizontal, 0, 0, 42, 36).Select
TextBox.name = refbox

ActiveWindow.Selection.ShapeRange.TextFrame.TextRange.Characters(Start:=1, Length:=0).Select
With ActiveWindow.Selection.TextRange
.Text = i
With .Font
.name = "Arial"
.Size = 9
.Color.SchemeColor = ppForeground
End With
End With
ActiveWindow.Selection.Unselect

Thank you!! :pray:
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
I haven't gone through the code you have here in detail, but do see a typo in the first line. *G* Could it be that?
 
Upvote 0

Forum statistics

Threads
1,214,944
Messages
6,122,384
Members
449,080
Latest member
Armadillos

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top