I try to open a specific MXD inside a running ArcMap-Application, but I always get "System.UnauthorizedAccessException" and ArcMap crashes.I have an Add-In-toolbar with a button, which opens a form (modal). Inside the form I show a combobox with available MXDs. In the OK-Buttons Click event I want to open the chosen MXD (below the mxd is a constant for test):
Dim mxd As String = "D:\temp4\mytest.mxd" Dim pApp As ESRI.ArcGIS.Framework.IApplication = My.ArcMap.Application Dim pMapDoc As ESRI.ArcGIS.Carto.IMapDocument = New ESRI.ArcGIS.Carto.MapDocumentClass If pMapDoc.IsMapDocument(mxd) Then pApp.OpenDocument(mxd) 'pApp.OpenDocument() End IfAlso if I try to open it without the optional argument (mxd), ArcMap crashes with the same error. But it should open the dialog to choose a MXD.What's wrong, who can help ?
أكثر...
Dim mxd As String = "D:\temp4\mytest.mxd" Dim pApp As ESRI.ArcGIS.Framework.IApplication = My.ArcMap.Application Dim pMapDoc As ESRI.ArcGIS.Carto.IMapDocument = New ESRI.ArcGIS.Carto.MapDocumentClass If pMapDoc.IsMapDocument(mxd) Then pApp.OpenDocument(mxd) 'pApp.OpenDocument() End IfAlso if I try to open it without the optional argument (mxd), ArcMap crashes with the same error. But it should open the dialog to choose a MXD.What's wrong, who can help ?
أكثر...