Solid Edge Framework Type Library
AddFromClipboard Method
Specifies a name for the new Variable object.
Specifies the unit type of the Variable object. Valid values are members of the UnitTypeConstants constant set.
Description
Creates a variable from the clipboard.
Syntax
Visual Basic
Public Function AddFromClipboard( _
   ByVal pName As String, _
   Optional ByVal UnitsType As Variant _
) As Object
Parameters
pName
Specifies a name for the new Variable object.
UnitsType
Specifies the unit type of the Variable object. Valid values are members of the UnitTypeConstants constant set.
Example
Private Sub Form_Load()
    Dim objApp As SolidEdgeFramework.Application
    Dim objDoc As SolidEdgePart.PartDocument
    Dim objVars As SolidEdgeFramework.Variables
    Dim objVar1 As SolidEdgeFramework.variable
    Dim objXLS As Excel.Workbook
    Dim objSheet As Excel.Worksheet
    Dim objCell As Excel.Range
    Const XLS_FILE = "T:\vbtests\testcases\Variables.xls"
    ' 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 Varialbes collection
    Set objVars = objDoc.Variables
    'Open the XLS application and the XLS file and copy the cell into ClipBoard
    Set objXLS = GetObject(XLS_FILE)
    Set objSheet = objXLS.ActiveSheet
    Set objCell = objSheet.Cells(2, 1)
    Call objCell.Copy
    'Create the variable with Formula linked to the XLS cell
    Set objVar1 = objVars.AddFromClipboard(pName:="Length")


    ' USER DISPLAY
    ' Release objects
    Set objApp = Nothing
    Set objDoc = Nothing
    Set objVars = Nothing
    Set objVar1 = Nothing
    Set objXLS = Nothing
    Set objSheet = Nothing
    Set objCell = Nothing
End Sub
See Also

Variables Collection  | Variables Members