'Attempt to connect to a running instance of SE
On Error Resume Next 'Turn on error handling
Set objSE = GetObject(, "SolidEdge.Application")
If Err Then 'Solid edge is not running
MsgBox "Solid Edge is not running, start Solid Edge first"
End 'end the program
End If
On Error GoTo 0 ''Turn off error handling
On Error GoTo errhandler
objSE.Visible = True 'Make the application window visible
Set objSEDocs = objSE.Documents 'get thet documents collection
'Determine if any documents are open
If objSEDocs.Count = 0 Then
MsgBox "Make sure a document is open and start the program again."
End
End If
'connect to the active document
Set objSEDoc = objSE.ActiveDocument
'save the active document. If no name has been provided, SE will show
'a saveas box
objSEDoc.save
'close the document
objSEDoc.close
'User: set objects to nothing
'User: end program

