"Key not found" error

"Key not found" error

Anonymous
Not applicable
551 Views
2 Replies
Message 1 of 3

"Key not found" error

Anonymous
Not applicable
When I run the code below I get this error:

Run-time error '-2145386476 (80200012)':
Key not found

with an "OK" button and a "Help" button. The help button does literally
nothing when clicked and the OK button just makes the dialog go away,
nothing more. Here's the code:
-------------------------------------------------------
Sub FixLayers()

Dim MyLayers As AcadLayers
Dim myLayer As AcadLayer

Set MyLayers = ThisDrawing.Layers

For Each myLayer In MyLayers

Set myLayer = ThisDrawing.Layers(Name)

With myLayer
Select Case UCase(Name)
Case "S-COCO"
.Name = "S-CONC-COLS"
Case "S-WACO"
.Name = "S-CONC-WALL"
Case "S-DIM"
.Name = "S-ANNO-DIMS"
Case Else
Debug.Print "Old Layer Name Not Found"
End Select
End With
Next

End Sub
-------------------------------------------------------



--
matthew g.


"...take my world all apart, take it now, take it now,
and serve the ones that I despise, speak the words I can't deny..."
-- Dan Haseltine
0 Likes
552 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Btw, it error out between the two lines here:

Set myLayer = ThisDrawing.Layers(Name)

With myLayer

The myLayer variable gets filled properly but it errors out before
getting to the next line.





--
matthew g.


"...take my world all apart, take it now, take it now,
and serve the ones that I despise, speak the words I can't deny..."
-- Dan Haseltine
0 Likes
Message 3 of 3

Anonymous
Not applicable
Matthew Gonzalez wrote:
> Btw, it error out between the two lines here:
>
> Set myLayer = ThisDrawing.Layers(Name)
>
> With myLayer
>
> The myLayer variable gets filled properly but it errors out before
> getting to the next line.
>


Done. I can't change the name of the entire layers collection. I need
to do it one layer at a time.... duh...




--
matthew g.


"...take my world all apart, take it now, take it now,
and serve the ones that I despise, speak the words I can't deny..."
-- Dan Haseltine
0 Likes