Hi Dmitry
And which code statement is generating the error? The first or the second?
Since xlXmlImportResult is an enumeration, you can't create it as an object using the new keyword. Generally, Office object models don't allow you to use new to create objects within the application interface. And when an Office application returns an Enum value, what you'll really get back is an Integer value corresponding to the enum's underlying value. So try something more like this:
int xmlImportResult;
xmlImportResult = Globals.ThisWorkbook.XmlImportXml(XMLDataset, out xmlMap1, true, range1);