T13856

can you help with entry SetLevel  method

Discussion created by T13856 on Apr 5, 2012
Latest reply on Apr 12, 2012 by T13856

I would like to create a new processbook with some text entries at level =1 and for each text entry I want to have some display entries at level =2

 

Please find the code below, it is very odd that setlabel works fine but not for SetLevel. Can you help with this?

 

 

 
Public Sub
    CreatePIW()
    Dim newwindow As New PBObjLib.Display
    Dim oBook As PBObjLib.ProcBook
    Dim oEntry As PBObjLib.Entry
    Dim oEntries As PBObjLib.Entries
    Dim directory As String
    Dim i As Short
    Dim j As Short
    Dim ItemtextList As New List(Of String)
    Dim itemlist As New List(Of String)
    ItemtextList.Add("item1")
    ItemtextList.Add("item2")
    directory = "C:\Documents and Settings\D15544\Desktop\testmacro\testbook.piw"
    itemlist.Add("content1")
    itemlist.Add("content2")
    For i = 0 To 1
        MsgBox("create new item text page for " & ItemtextList.Item(i))
        app.ProcBooks.Open(directory)
        oBook = app.ActiveProcBook
        oEntry = oBook.Entries.Add(ItemtextList.Item(i))
        For j = 0 To 1
            MsgBox("create new contents on each text page for content " & (j + 1))
            oEntry = oBook.Entries.InsertAfter(oEntry, itemlist.Item(j))
            oEntry.SetLabel("changed")
            oEntry.SetLevel(2)
            oEntry.DefineAction(1, itemlist.Item(j), directory)
            MsgBox("entry and window is linked")
        Next j
        j = 0
    Next i
End sub

 

Outcomes