Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2003
    Posts
    123

    Unanswered: XML export not working with macro/code

    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

  2. #2
    Join Date
    Sep 2009
    Posts
    1

    XML export not working with macro

    Has anyone been able to determine the cause of this error? I am having the same issue, and even a certified expert has not been able to answer the question.

  3. #3
    Join Date
    Jun 2011
    Posts
    1

    Solved: XML export not working with macro/code

    The export is failing because you are trying to overwrite an existing file. Add "Overwrite:=True" as a parameter and it will work.

    Code:
    Sub Macro4()
       ActiveWorkbook.XmlMaps("Root_Map").Export URL:= _
       "C:\Documents and Settings\nbkcp6y\Desktop\7.xml", _
       Overwrite:=True
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •