I recorded a macro where I exported a mapped list to an XML file. It worked fine when recording the macro, and if I use the keyboard shortcut I assigned it also works. But if I try to create a button that runs the macro or copy the macro into the Click() event of another button, I get a run time error. The file I'm exporting to is in the same location and has the same name each time.
"Run time error '-2147467259 (80004005)': Method 'Export' of object 'XmlMap' failed"
Sub Macro4()
'
' Macro4 Macro
'
' Keyboard Shortcut: Ctrl+Shift+X
'
ActiveWorkbook.XmlMaps("Root_Map").Export URL:= _
"C:\Documents and Settings\nbkcp6y\Desktop\7.xml"
End Sub