VBA Syntax
Trying to get the VBA-Code right for checking if a layer exist or not in a drawing.I've tried this : For nCount = 1 To IntelliCAD.ActiveDocument.Layers.CountIf (IntelliCAD.ActiveDocument.Layers.Item(nCount).Name = "V-57411") Thenbut it's obviously not right. Can someone out there please help me out.Regards ,Per Andersson
Comments
-
I created a procudere that checks if a layer exists, the test procedure calls the function to show you how it works.Note: I didn't find an error in your code.'****START CODEPublic Sub Test() If LayerExists(ThisDocument, "V-57411") Then MsgBox "Layer Exists" Else MsgBox "Layer Does Not Exist" End IfEnd SubPrivate Function LayerExists(Drawing As IntelliCAD.Document, _ LayerName As String) As Boolean Dim bExists As Boolean Dim Layer As Layer bExists = False For Each Layer In Drawing.Layers If Layer.Name = LayerName Then bExists = True Exit For End If Next LayerExists = bExists Set Layer = NothingEnd Function'END CODE***
0