Differences between XM and V8i using opendesignfileforprogram

I've posted this problem in a another thread that had a different subject.

I'm getting different results running this code in XM and in V8i.

In XM the result is Num=5, which is correct.

In V8i the result is Num=1, which is wrong. Apparently oLevels only gets level "Default" and ignores the others.

Sub NumLevels()
Dim oFile As DesignFile
Dim FileNameDgn As String
Dim Num As Integer
Dim oLevels As Levels

FileNameDgn = "C:\Lixo\Test.dgn"
Set oFile = OpenDesignFileForProgram(FileNameDgn, False)
Set oLevels = oFile.Levels
Num = oLevels.Count
End Sub

Any idea why?

Parents Reply
  • Robert,

    Problem solved with "oFile.Save".

    My macro works under Excel. The purpose is to rename levels in a list of Dgn files.

    For each level that is renamed it's necessary to process "oFile.DefaultModelReference.Levels.Rewrite" and "oFile.Save".

    I'm just curious why this behaviour is different in XM and in V8i, but no problem.

    Thanks for your help.

Children