Private Sub Form_Load()
Dim objApp As solidedgeFramework.Application
Dim objDoc As solidedgeAssembly.AssemblyDocument
' 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.AssemblyDocument")
objApp.Visible = True
Else
Set objDoc = objApp.ActiveDocument
End If
' Using Close method without any arguments
Call objDoc.Close
If objApp.Documents.Count <> 0 Then
MsgBox "Unable to close the document without using any arguments"
End If
' Using Close method with saving it to a filename
Set objDoc = objApp.Documents.Add(progID:="SolidEdge.AssemblyDocument", _
TemplateDoc:="normal.asm")
' Do a Fit in the document. This is one way of updating the document.
' While closing the documet with argument(SaveChanges := True) _
the document is saved using Filename argument by calling SaveAs method.
Call objDoc.Windows(1).View.Fit
Call objDoc.Close(SaveChanges:=True, Filename:="T:\Temp\temp.asm")
If objApp.Documents.Count <> 0 Then
MsgBox "Unable to close the document with changes"
End If
' USER DISPLAY
' Release objects
Set objApp = Nothing
Set objDoc = Nothing
End Sub