Deleting all models


Applies To
Product(s):MicroStation
Version(s):08.11.09.459
Environment: N/A
Area: Programming
Subarea: VBA
Original Author:Sven Zigelski, Bentley Technical Support Group

 

 

 

 

 

 

Problem Description

I want to delete all models of a DGN with a keyin. But there is no keyin available. How to solve this Problem?

Steps to Resolve

The Task can be done with MVBA

------------------
Sub delete_all_models()

    Dim oMods As ModelReferences
    Dim oMod As ModelReference
    Dim i As Long
    Set oMods = ActiveDesignFile.Models
    oMods(1).Activate
    For i = 2 To oMods.Count
        oMods.Delete oMods(2)
    Next

End Sub
------------------
(by Artur Goldsweer)

This macro will jump to the model with the lowest index and will delete the next higher until there are no models left excepting the indelible standard model.