English

Error: Access Denied or Permission Denied when calling the IApplication::OpenDocument method from a modal dialog box

Error Message

Attempting to call the IApplication::OpenDocument method from within a modal dialog box generates a permissions error.

When programming in VB6, the error message "Permission Denied" may occur with an error number of 70.

When programming in Visual Studio .NET, an exception of type System.UnauthorizedAccessError may occur and return "Access Denied".

Cause

OpenDocument and NewDocument cannot be called when there is a modal dialog box present in the application. This is prevented by the internal design of ArcGIS.

Solution or Workaround

  • Close the dialog box before calling the OpenDocument method. This approach is often used by core ESRI modal dialog boxes, such as the Open Document dialog box.
  • If you require your dialog box to stay open across the transition between documents then the dialog box should be displayed in a modeless manner.