Solid Edge Framework Type Library
Add Method
Specifies the type of document to create. The following types are supported: SolidEdge.PartDocument, SolidEdge.SheetMetalDocument, SolidEdge.AssemblyDocument, SolidEdge.DraftDocument. If you omit this parameter, two behaviors may result, depending on the state of the Application.DisplayAlerts property: if Application.DisplayAlerts property is True, calling this method invokes the Solid Edge New dialog box so that the interactive user can select the type of document to add, and the method does not return until the dialog box is dismissed; if the Application.DisplayAlerts is False, calling this method returns a runtime error.
Specifies the name of the document being used as the template document. If a template is not provided in this argument, the associated Normal template is used.
Description
Adds an occurrence of the referenced object.
Syntax
Visual Basic
Public Function Add( _
   Optional ByVal ProgID As Variant, _
   Optional ByVal TemplateDoc As Variant _
) As Object
Parameters
ProgID
Specifies the type of document to create. The following types are supported: SolidEdge.PartDocument, SolidEdge.SheetMetalDocument, SolidEdge.AssemblyDocument, SolidEdge.DraftDocument. If you omit this parameter, two behaviors may result, depending on the state of the Application.DisplayAlerts property: if Application.DisplayAlerts property is True, calling this method invokes the Solid Edge New dialog box so that the interactive user can select the type of document to add, and the method does not return until the dialog box is dismissed; if the Application.DisplayAlerts is False, calling this method returns a runtime error.
TemplateDoc
Specifies the name of the document being used as the template document. If a template is not provided in this argument, the associated Normal template is used.
Example
Private Sub Form_Load()
    Dim objApp As SolidEdgeFramework.Application
    Dim objDoc As SolidEdgePart.PartDocument
    Dim objDocuments As SolidEdgeFramework.Documents
    Dim objAssydoc As SolidEdgeAssembly.AssemblyDocument
    Dim objShMetalDoc As SolidEdgePart.SheetMetalDocument
    Dim objDraftDoc As SolidEdgeDraft.DraftDocument
    Dim strPartTemplate As String
    Dim strAssyTemplate As String
    Dim strShMetalTemplate As String
    Dim strDraftTemplate As String
    ' 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
    objDoc.Close
    strPartTemplate = "T:\vbtests\TestCases\normeng.par"
    strAssyTemplate = "T:\vbtests\TestCases\normeng.asm"
    strShMetalTemplate = "T:\vbtests\TestCases\normeng.psm"
    strDraftTemplate = "T:\vbtests\TestCases\normeng.dft"
    'Get the Documents collection
    Set objDocuments = objApp.Documents
    'Add a PartDocument to the collection
    Set objDoc = objDocuments.Add(progID:="SolidEdge.PartDocument")
    ' USER DISPLAY
    ' Release objects
    Set objApp = Nothing
    Set objDoc = Nothing
    Set objDocuments = Nothing
    Set objAssydoc = Nothing
    Set objShMetalDoc = Nothing
    Set objDraftDoc = Nothing
End Sub
See Also

Documents Collection  | Documents Members