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
  • Hi,

    I'm just guessing in the dark...  Even with autosave turned on, you still have to manually save the OpenDesignFileForProgram.  So I would first double check to make sure that the oFile is open for read/write (not read only), and then end it with oFile.Save  .  After that I would probably need to see the code to make any good guesses.

    --Robert

Children