AnsweredAssumed Answered

IMapDocument from application

Question asked by geonetadmin on Apr 21, 2010
Latest reply on Apr 22, 2010 by kirkktx
Original User: abrown

Hi All,

I'm trying to get a reference to the current MXD so I can save it to disk before making a backup copy.  I tried the following snippet from inside a BaseCommand class I created.

IMapDocument mapDoc = m_application.Document as IMapDocument;
mapDoc.Save(mapDoc.UsesRelativePaths, false);

This is how the ESRI examples show it working, but I get a null reference on mapDoc each time.  The MXD is loaded and I can get IMxDocument just fine.  I can't save that though, I need IMapDocument.

Any thoughts?