Skip to Main Content
Need Support? Let’s guide you to the right answer or agent.
Status Needs review
Categories Programming
Created by Guest
Created on Nov 24, 2025

[VBA] OpenDesignFile

According to API:

OpenDesignFile opens an existing design file after closing the currently open design file.
If an error is raised during this method, the original design file is left open.

But no error is actually raised if opened file is not valid for example renamed txt file as dgn.

VBA example not valid as errortrap does nothing:

Example

    Sub main()
Dim fileName As String

fileName = "D:\Bentley\Workspace\Projects\Examples\General\dgn\FlowTags.dgn"

On Error GoTo errorTrap
OpenDesignFile fileName, False, msdV7ActionWorkmode
On Error GoTo 0

Exit Sub

errorTrap:
MsgBox Err.Description
Resume Next
End Sub