changing the display condition of a user layer

Discussion created by karl.kechele on Aug 30, 2010
Latest reply on Nov 18, 2010 by karl.kechele



I want to change the "Display_Condition" of an user layer via VBA in an excel file.

When I create a cell object with the "Edit"-call I get a collection of all user layers.

But in these user layers I cannot access the "Display_Condition" (only the property "Name" is accessable).

How I can change the "Display_Confition" of an user layer?

When I call the "Commit"-methode I get an error message.

When I don't call all the "Commit"-methode I get an error when calling the sub twice.

Whenn calling the methode libApp.CloseActiveDatabase or libApp.Quit I get also an error message.

What should I do here?



Karl Kechele


The following script displays the user layers of a certain cell:

Private Sub CommandButton1_Click()
  Dim ulayer
  Set my_cells = New Dictionary
  Dim cell As CellEditorAddinLib.cell
  Dim cellname As String
  Dim lib As CellEditorAddinLib.CellDB
  Set libApp = CreateObject("CellEditorAddin.CellEditorDlg")
  Set lib = libApp.OpenDatabase("H:\tmp\test_lib\test_lib.lmc", False)
  For Each cell In lib.ActivePartition.Cells
    my_cells.Add cell.Name, cell
  cellname = "ESDRAC10-005"

  Set cell = my_cells.Item(cellname)
  MsgBox (cell.Name)
  lidx = 8
  Set cellobj = cell.Edit
  For Each ulayer In cellobj.UserLayers
    Cells(lidx, 1) = ulayer.Name
    lidx = lidx + 1
End Sub