Message 1 of 2
Code help
Not applicable
04-06-2006
07:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Morning All,
I have tried writing the below function to create a new layer. But it type
mismatches on the .TrueColor = intColourNumber line. How can I set the
colour of my layer. Also is it necessary to set variables to nothing at the
end or they will disappear automatically when the function is finished?
Public Function CreateNewLayer(ByVal strLayerName As String, intColourNumber
As Integer) As AcadLayer
Dim objAcadLayer As AcadLayer
'Create and reference the new layer
Set objAcadLayer = ThisDrawing.Layers.Add(strLayerName)
'Set layer properties
With objAcadLayer
.TrueColor = intColourNumber
End With
Set CreateNewLayer = objAcadLayer
Set objAcadLayer = Nothing
End Function
I have tried writing the below function to create a new layer. But it type
mismatches on the .TrueColor = intColourNumber line. How can I set the
colour of my layer. Also is it necessary to set variables to nothing at the
end or they will disappear automatically when the function is finished?
Public Function CreateNewLayer(ByVal strLayerName As String, intColourNumber
As Integer) As AcadLayer
Dim objAcadLayer As AcadLayer
'Create and reference the new layer
Set objAcadLayer = ThisDrawing.Layers.Add(strLayerName)
'Set layer properties
With objAcadLayer
.TrueColor = intColourNumber
End With
Set CreateNewLayer = objAcadLayer
Set objAcadLayer = Nothing
End Function