Can anyone tell me why the following piece of code would result in an "run time error key not found". I use 2002 at work and the rest of this code works fine, but with 2004 at home it doesn't. What did I miss? Public Static Function blockin() On Error Resume Next Set clayer = ActiveDocument.ActiveLayer Set layobj = ThisDrawing.Layers.Item(layername) If Err <> 0 Then 'Debug here->' Set layobj = ThisDrawing.Layers.Add(layername) layobj.Color = layercolor End If ActiveDocument.ActiveLayer = layobj