If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > XML export not working with macro/code

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-16-06, 15:08
jrn0074 jrn0074 is offline
Registered User
 
Join Date: Aug 2003
Posts: 123
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
Reply With Quote
  #2 (permalink)  
Old 09-28-09, 15:19
yohmans yohmans is offline
Registered User
 
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.
Reply With Quote
  #3 (permalink)  
Old 06-24-11, 08:31
bobbo33 bobbo33 is offline
Registered User
 
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On