Check For Existence of View Group using VBA

Hello MicroStation Programming Community,

How would one check for the existence of a View Group within the active Design File using VBA code? I can't seem to find examples of this. Looking to delete the View Group if it exists.

Thanks!

Parents Reply
  • The matching View Group is not deleted. Per your suggestion, I revised the code to use oViewGroup.Delete. The result is the same (View Group not deleted).

    ' Declare variables.
     Dim oViewGroup As MicroStationDGN.ViewGroup
     
     ' Loop through each View Group.
     For Each oViewGroup In ActiveDesignFile.ViewGroups
         ' View Group Name is "Multi-Model Views".
         If (oViewGroup.Name = "Multi-Model Views") Then
             ' Run command to delete "Multi-Model Views" View Group.
             ' CadInputQueue.SendKeyin "viewgroup delete " & Chr(34) & "Multi-Model Views" & Chr(34)
             
             ' Delete View Group.
             oViewGroup.Delete
         End If
     Next

    ProjectWise Explorer CONNECT Edition, Version 10.00.03.453

    ProjectWise Drive, Version 2022.1.328

    OpenRoads Designer CONNECT Edition, Version 10.09.00.91

    OpenRoads Designer CE 202 Release 2, Version 10.10.21.4

    Power GEOPAK V8i (SELECTseries 10), Version 08.11.09.918

Children