Private Sub Form_Load()
Dim objApp As SolidEdgeFramework.Application
Dim objDoc As SolidEdgeDraft.DraftDocument
Dim objSheet As SolidEdgeDraft.Sheet
Dim objTextBox As SolidEdgeFrameworkSupport.TextBox
Dim objLeaders As SolidEdgeFrameworkSupport.Leaders
Dim lngCount As Long
' Report errors
Const PI = 3.14159265358979
' Create/get the application with specific settings
On Error Resume Next
Set objApp = GetObject(, "SolidEdge.Application")
If Err Then
Err.Clear
Set objApp = CreateObject("SolidEdge.Application")
Set objDoc = objApp.Documents.Add("SolidEdge.DraftDocument")
objApp.Visible = True
Else
Set objDoc = objApp.ActiveDocument
End If
'getting the Active Sheet object
Set objSheet = objDoc.ActiveSheet
'Create a text Box in the active sheet.
Set objTextBox = objSheet.TextBoxes.AddByHtWdAng(x1:=0.1, y1:=0.1, z1:=0, ht:=0.1, wd:=0.15, ang:=0)
'Add some text to the Text
objTextBox.Text = "THIS IS FOR TESTING ONLY"
'Create Leaders collection object
Set objLeaders = objSheet.Leaders
'Create two leaders attatched to text box
Call objLeaders.Add(x1:=0.1, y1:=0.1, z1:=0, x2:=0.1, y2:=0.3, z2:=0)
'Get the Count in the collection
lngCount = objLeaders.Count
' USER DISPLAY
' Release objects
Set objApp = Nothing
Set objDoc = Nothing
Set objSheet = Nothing
Set objTextBox = Nothing
Set objLeaders = Nothing
End Sub