XML Format Issue
Results 1 to 3 of 3

Thread: XML Format Issue
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Sep 2016
    Posts
    40
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default XML Format Issue

    Hi

    I have an excel macro that is creating an XML but it saving the XML file like this:

    HTML Code:
    <?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>
    However I want it like this:

    HTML Code:
    <?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><&#91;LEFT&#93;&#91;COLOR=#222222&#93;&#91;FONT=Verdana&#93;basis&#91;/FONT&#93;&#91;/COLOR&#93;&#91;/LEFT&#93;>F</&#91;LEFT&#93;&#91;COLOR=#222222&#93;&#91;FONT=Verdana&#93;basis&#91;/FONT&#93;&#91;/COLOR&#93;&#91;/LEFT&#93;><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
    Any one have any ideas how?
    Last edited by RoryA; Jul 18th, 2019 at 07:21 AM.

  2. #2
    New Member
    Join Date
    Sep 2016
    Posts
    40
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: XML Format Issue

    Anyone able to help me?

  3. #3
    New Member
    Join Date
    Sep 2016
    Posts
    40
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: XML Format Issue

    Im trying to get the XML to read in one continous line rather than having the spacing, not sure how to resolve this

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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