"Access Denied" when setting .Name property of previously named Sh

C

Cory

When referencing a shape by it's name or otherwise, is the .Name prperty
locked so that it cannot be set? I have some code similar to this:

intCurPageNum = ActiveDocument.ActiveView.ActivePage.PageIndex
For Each shpOverlayShape in ActiveDocument.ActiveView.ActivePage
strShapeName = Left(shpOverlayShape.Name, 6)
Select Case strShapeName
Case "Graphi"
shpOverlayShape.Name = "GraphicNumber" & CStr(intCurPageNum)
.... Lines omitted for brevity ...
End Select
Next shpOverlayShape
Set shpOverlayShape = Nothing
End Sub

The code is supposed to cycle through the shapes and if the first 6
characters of the name = a preset value, it changes the name to the long form
of that value and the page number. This allows a different sub that accessed
shapes based on thier name to get the correct shape on a page by repairing
the shape numbers if user changes position of a page.

Any help would be appreciated
Cory
 
C

Cory

Actually I figured out what was going on. I was trying to name a Shape one
one page the same as a Shape on another page. Undoubtedly all of the shapes
(regardless of which page they are on) are all in the same collection, and
thus no two may have the same name. So, I created another sub that renames
all of the shapes with temporary names and then renames them with the proper
names.


Cory
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top