+ Reply to Thread
Results 1 to 7 of 7

How to Convert Excel to Xml

  1. #1
    Registered User
    Join Date
    12-20-2011
    Location
    cheenai
    MS-Off Ver
    Excel 2007
    Posts
    68

    How to Convert Excel to Xml

    Hi All

    I am new bee to excel and Xml.

    In my Sheet1 A12 I have a text

    Date of board meeting when final accounts were approved

    In the Sheet 1 B12 i have entered a data

    2011-12-07

    I have to convert into xml. The output should like in this format


    <in-ca:DateOfBoardMeetingWhenFinalAccountsWereApproved >2011-12-07</in-

    ca:DateOfBoardMeetingWhenFinalAccountsWereApproved>


    How can i do it. I dont know macros.

    kindly give me any ideas.


    Thanks in advance

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: How to Convert Excel to Xml

    Maybe:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    12-20-2011
    Location
    cheenai
    MS-Off Ver
    Excel 2007
    Posts
    68

    Re: How to Convert Excel to Xml

    Thanks Kyle it is working good. Thanks for your help.

    And i have another doubt .The output should be like this

    <in-ca:AddressOfRegisteredOfficeOfCompany id="ITEM4" contextRef="CURRENT-YEAR-2010-11">20-12-2011</in-ca:AddressOfRegisteredOfficeOfCompany>


    Sub ExportXML()
    Dim fNum As Integer
    Dim tagN As String
    Dim tDate As String
    Const fName As String = "D:\My Documents\MyXMLFile.xml"
    Const nSpace As String = "http://www.YourNameSpace.com/"


    fNum = FreeFile()

    With Sheets("Sheet1")
    tagN = Replace(.Range("A12").Text, " ", "")

    id="item1"

    ContextRef1="Current-Year-2011"

    tDate = Format(.Range("B12").Value, "dd-MM-yyyy")

    Open fName For Output As fNum

    Print #fNum, "<?xml version=""1.0"" encoding=""ISO-8859-1"" ?>"
    Print #fNum, "<root"
    Print #fNum, "xmlns:in-ca=""" & nSpace & """>"
    Print #fNum, "<in-ca:" & tagN &= "&id"" " _
    "ContextRef" = &ContextRef1" & tDate & "</in-ca:" & tagN & ">"
    Print #fNum, "</root>"

    Close #fNum

    End With


    I have receiving errors. I dont know how to use within code. " " .Could any one help to get this output.

  4. #4
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: How to Convert Excel to Xml

    karthisucc9

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  5. #5
    Registered User
    Join Date
    12-20-2011
    Location
    cheenai
    MS-Off Ver
    Excel 2007
    Posts
    68

    Re: How to Convert Excel to Xml

    Hi all

    Could any one can help me to get this output in excel. I am new to Excel VBA

    <in-ca:AddressOfRegisteredOfficeOfCompany id="ITEM4" contextRef="CURRENT-YEAR-2010-11">20-12-2011</in-ca:AddressOfRegisteredOfficeOfCompany>

    Thanks and Regards
    Last edited by karthisucc9; 12-21-2011 at 06:49 AM.

  6. #6
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: How to Convert Excel to Xml

    Hi karthisucc9

    No problem except you need to read the forum rules and add code tags to your code and then we can help.

  7. #7
    Registered User
    Join Date
    12-20-2011
    Location
    cheenai
    MS-Off Ver
    Excel 2007
    Posts
    68

    Re: How to Convert Excel to Xml

    hi all I want this output in xml from excel

    <in-ca:AddressOfRegisteredOfficeOfCompany id="ITEM4" contextRef="CURRENT-YEAR-2010-11">20-12-2011</in-ca:AddressOfRegisteredOfficeOfCompany>


    Please Login or Register  to view this content.
    I dont know how to print multiple data. I have problem with use " "

    Could any one help me.
    Last edited by karthisucc9; 12-21-2011 at 08:30 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1