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:
 

Some videos you may like

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

DaVinci

Board Regular
Joined
Feb 18, 2004
Messages
55
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?
 

Watch MrExcel Video

Forum statistics

Threads
1,122,481
Messages
5,596,399
Members
414,063
Latest member
N_Bates

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
Top