s.hellenkamp

Read out Cell-Descrition from local Cell-Lib

Discussion created by s.hellenkamp on Apr 9, 2020
Latest reply on Apr 14, 2020 by .-.--.--

I trying to read out the Cell-description from a local Cell-Library.

I used the following Code, it works, but only if the cell-editor is allready open!?

Cant' find a way without open the cell-editor and can't find a way to open the cell-editor with script...

 

' This function retrieves an automation license for a document
'
Dim app
Set app = GetObject(,"MGCPCB.Application")
    On Error Resume next
    Dim key,licenseServer,licenseToken,docObj
    Set GetLicensedDoc = Nothing
    ' collect the active document
    Set docObj = app.ActiveDocument
 
    ' Ask Expedition’s document for the key
    key = docObj.Validate(0)
    ' Get token from license server
    Set licenseServer = CreateObject("MGCPCBAutomationLicensing.Application")
    licenseToken = licenseServer.GetToken(key)
    Set licenseServer = Nothing
    ' Ask the document to validate the license token
    Err.Clear
    docObj.Validate(licenseToken)
 
    ' everything is OK, return document
    Set GetLicensedDoc = docObj
Dim cellEditorObj
Set cellEditorObj = docObj.CellEditor    'epcbAppCellEditor The numerical value for this constant is 8.
Dim cellDB
Set cellDB = cellEditorObj.ActiveDatabase
cellEditorObj.Visible = False
'cellEditorObj.Visible = True
For Each PartitionObj In CellDB.Partitions
 msgbox "PartitionName: " & PartitionObj.Name &"CellCount: " & PartitionObj.Cells.Count
        For Each CellObj In cellDB.Partitions.Item(1).Cells
             msgBox CellObj.Name & "-########-" & CellObj.Description
        Next
Next
MsgBox "Done."
'CellEdDlg.UnLockServer
Set CellDB = Nothing
CellEdDlg.Quit
Set CellEdDlg = Nothing

Outcomes