PPT2002: Macro Run-Time Error: The Item with the Specified Name Wasn't Found (278575)
The information in this article applies to:
- Microsoft PowerPoint 2002
This article was previously published under Q278575 SYMPTOMS
In Microsoft PowerPoint, when you record a macro to insert an object into a presentation slide, and you then run the macro, you may receive a run-time error message similar to the following:
The item with the specified name wasn't found.
When you click End on the error message, the object appears as expected.
This behavior occurs with AutoShapes, Rectangles, Ovals, Text Boxes, WordArt, ClipArt, and Pictures.
CAUSE
This behavior can occur if you create a macro to insert an object, but as part of the recording, you clear your selection of, and then reselect, the object before you stop recording the macro, as in the following example:
- Start PowerPoint, and then accept the default presentation.
- On the Tools menu, point to Macro, and then click Record New Macro.
- Type Test in the Macro name box, and then click OK.
- On the Drawing toolbar, click Oval.
- Draw an oval on the slide.
- Click outside the oval to clear your selection of the oval.
- Click to reselect the oval.
- On the Tools menu, point to Macro, and then click Stop Recording.
- On the Insert menu, click New Slide.
- On the Tools menu, point to Macro, and then click Macros.
- In the Macro name list, click Test, and then click Run.
The oval appears as expected. - Delete the oval.
- On the Tools menu, point to Macro, and then click Macros.
- In the Macro name list, click Test, and then click Run.
You receive the run-time error message described in the "Symptoms" section.
WORKAROUND
To work around the behavior, follow these steps:
- On the Tools menu, point to Macro, and then click Macros.
- In the Macro name list, click Test, and then click Edit.
The macro is currently similar to the following (note that the coordinates will vary):
Sub Test()
ActiveWindow.Selection.SlideRange.Shapes.AddShape(msoShapeOval, 246#, 198#, 210#, 228#).Select
ActiveWindow.Selection.Unselect
ActiveWindow.Selection.SlideRange.Shapes("Oval 4").Select
End Sub
- Edit the macro so that it reads as follows:
Sub Test()
ActiveWindow.Selection.SlideRange.Shapes.AddShape(msoShapeOval, 246#, 198#, 210#, 228#).Select
'grab the name of the shape just created
strName = ActiveWindow.Selection.ShapeRange.Name
ActiveWindow.Selection.Unselect
'select that shape using the NEW name
ActiveWindow.Selection.SlideRange.Shapes(strName).Select
End Sub
STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Major | Last Reviewed: | 7/12/2001 |
---|
Keywords: | kbbug kberrmsg KB278575 |
---|
|