Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi.
I can't save functions as layer, what can i do?
Sub main()
Dim oLayer123 As Layer
oLayer123 = Get_layer()
End Sub
Function Get_layer() As Layer
Dim oDoc As DrawingDocument
Set oDoc = ThisApplication.ActiveDocument
Dim styleMgr As DrawingStylesManager
Set styleMgr = oDoc.StylesManager
Dim oLayer As Layer
On Error GoTo ErrorHandler
Set oLayer = styleMgr.Layers.Item("test_layer")
Get_layer = oLayer ' problem
ErrorHandler:
Dim oNewLayer As Layer
Set oLayer = oDoc.StylesManager.Layers.Item(1)
Set oNewLayer = oLayer.Copy("test_layer")
oNewLayer.Color = ThisApplication.TransientObjects.CreateColor(255, 0, 0)
oNewLayer.LineWeight = 1
oNewLayer.LineType = LineTypeEnum.kContinuousLineType
Get_layer = oNewLayer ' problem
End Function
Solved! Go to Solution.