Private Sub Form_Load()
Dim objApp As SolidEdgeFramework.Application
Dim objDoc As SolidEdgePart.PartDocument
Dim objEnvironments As SolidEdgeFramework.Environments
Dim objEnvironment As SolidEdgeFramework.Environment
Dim lngIndex 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.PartDocument")
objApp.Visible = True
Else
Set objDoc = objApp.ActiveDocument
End If
'Get the Environments collection
Set objEnvironments = objApp.Environments
'Get the Part environment i.e., 9th item in the Environments collection
Set objEnvironment = objEnvironments(9)
'Get a reference to the Commandbars collection object
lngIndex = objEnvironment.Index
' USER DISPLAY
' Release objects
Set objApp = Nothing
Set objDoc = Nothing
Set objEnvironment = Nothing
Set objEnvironments = Nothing
End Sub