Issue when setting level from level library ...

We have discovered the following problem:

In our environment (Microstation V8i (SELECT Series 3) - Version 08.11.09.459) we have got several VBA programs in place which support the users to create dimensionings of elements.

After starting the first sub the program sets the desired level which should be used for dimensioning (ie. the user selects a level name in a userform and the desired level is set as level within the dimension style).

Here is the code of this selection:

If FrmDeckenbemassung.ob_Bemassung = True Then

  Set lev = ActiveDesignFile.Levels.Find("DECKENELEMENTIERUNG_BEMASSUNG")
  
  If Not lev Is Nothing Then
  
    Set ActiveSettings.DimensionStyle.Level = lev
  
  End If
  
  Set lev = ActiveDesignFile.Levels.Find("DECKENELEMENTIERUNG_BEMASSUNG_LÜFTUNG")

  If Not lev Is Nothing Then lev.IsDisplayedInView(ActiveDesignFile.Views(1)) = False

Else

  Set lev = ActiveDesignFile.Levels.Find("DECKENELEMENTIERUNG_BEMASSUNG_LÜFTUNG")
  
  If Not lev Is Nothing Then
  
    Set ActiveSettings.DimensionStyle.Level = lev
  
  End If
  
  Set lev = ActiveDesignFile.Levels.Find("DECKENELEMENTIERUNG_BEMASSUNG")

  If Not lev Is Nothing Then lev.IsDisplayedInView(ActiveDesignFile.Views(1)) = False

End If


Now - the Levels "DECKENELEMENTIERUNG_BEMASSUNG" and "DECKENELEMENTIERUNG_BEMASSUNG_LÜFTUNG" belong to a level library.

The code works fine as long as the level is already in use within the ActiveDesignFile. If it is not it ends up in a runtime error:

When I now stop the code, and add p.ex. a line element that uses the same level that was selected for the dimensioning and re-run the dimensioning sub again then it works without troubles!


What's the problem with using a level from a level library when it was not used before in the ActiveDesignFile?