Hi
I have an excel macro that is creating an XML but it saving the XML file like this:
However I want it like this:
This is the macro:
Any one have any ideas how?
I have an excel macro that is creating an XML but it saving the XML file like this:
HTML:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<funds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<fund>
<id>123456</id>
<name>Apple</name>
<basis>F</basis>
<type>Fruit</type>
<valdate>11-07-2019</valdate>
<creationdatetime>11-07-2019 16:34:44</creationdatetime>
HTML:
<?xml version="1.0" encoding="utf-8"?><funds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><fund><id>[LEFT][COLOR=#222222][FONT=Verdana]123456[/FONT][/COLOR][/LEFT]</id><name>[LEFT][COLOR=#222222][FONT=Verdana]Apple[/FONT][/COLOR][/LEFT]</name><[LEFT][COLOR=#222222][FONT=Verdana]basis[/FONT][/COLOR][/LEFT]>F</[LEFT][COLOR=#222222][FONT=Verdana]basis[/FONT][/COLOR][/LEFT]><type>[LEFT][COLOR=#222222][FONT=Verdana]Fruit[/FONT][/COLOR][/LEFT]</type><valdate>10-07-2019</valdate><creationdatetime>10-07-2019 13:50:42</creationdatetime>
This is the macro:
Code:
Sub Macro1()
'
' Macro1 Macro
'
Application.DisplayAlerts = False
Macrofile = ActiveWorkbook.Name
Range("Q4").Select
File_Name = ActiveCell
'
Range("A2:F96").Select
Workbooks.OpenXML Filename:= _
"G:\Destop\Sample.xml" _
, LoadOption:=xlXmlLoadImportToList
XML_Upload = ActiveWorkbook.Name
Windows("XML creator.xls").Activate
Selection.Copy
Windows(XML_Upload).Activate
Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveWorkbook.SaveAsXMLData Filename:= _
File_Name _
, Map:=ActiveWorkbook.XmlMaps("xml_Map")
ActiveWindow.Close
Sheets("TEST").Select
Message = MsgBox("Done", vbOKOnly, "")
End Sub
Last edited by a moderator: