EXCEL, create a XML-file from a data in table via

2019-09-06 19:34发布

EXCEL

The file luxom2xlm is available at https://www.dropbox.com/sh/f3dd2aby8wxpn5x/AAAOqaUV9LvtgrNghMT71AkHa?dl=0

There are also screenshots (because I'm not allowed to insert pictures in it, I do not have 10 reputations ... correction it seems that I was wrong)

vba code to create a XML - https://www.dropbox.com/s/6vr30uydv9kmgqq/EXCEL_luxom_macro.PNG?dl=0

formula doesn't work "inconsistent error" in excel2013- https://www.dropbox.com/s/mnpaurktpj39o21/EXCEL_luxom_columns.PNG?dl=0

(Unfortunately I just allowed to ask one question a day, so I'll open tomorrow a new question ...) (not the best solution for solving inconsistent problems but it is the only one I found till now - see comment)

1. vba code : to create XML file

I try to figure out 'how' to make macro to extract the data directly from a table and create a XML file and validate it via a XSD-file. Manually it work fines, so I've recorded vba code.

But unfortunately this seem not to work.

' REF VBA   - http://www.globaliconnect.com/excel/index.php?option=com_content&view=article&id=162:excel-vba-calling-sub-procedures-a-functions-placement-in-modules&catid=79&Itemid=475
'     EXCEL - http://excelcentral.com

Sub Export2XML()
'
' export2XML Macro
'
'  REF : http://office.microsoft.com/en-gb/excel-help/export-xml-data-HP010206401.aspx
'

'
    Path_Name = Sheets("info").Range("c21").Value ' Path_Name = E:\luxom.xml

    'work sheet luxom_input
    Sheets("luxom_input").Select

    'where Luxom__Elements_In_Output_Map is the root element of the XSD-file
    'which is used as reference

    'method 1 created via a record macro doesn't work
    ActiveWorkbook.XmlMaps("Luxom__Elements_In_Output_Map").export URL:= _
        "E:\luxom.xml"

    'method 2 
    ActiveWorkbook.XmlMaps("Luxom__Elements_In_Output_Map").export URL:= _
        Path_Name
End Sub

I would like to make it dynamicaly, that is why I've entered

2. TABLE : formula not working INCONSISTENT ERROR (the solution I found - see comment)

The formula worked fine in EXCEL2010, and in EXCEL2013 re-typed and recognised also but now I get an error formula

Neither the help from microsoft solved my problem

http://office.microsoft.com/en-ca/mac-excel-help/correct-an-inconsistent-formula-HA102927556.aspx

Sheet "luxom_input", table "T_LuxomInput",

  • in column "O - ID" (address = a fixed stringformat)

    =CONCATENATE([@[networkID]] ;address; [@[groupID]] ;address; TEXT([@[HexAddress]];"00"))

  • in column "O - KAST"

    =IF(AND(IFERROR(FIND(start_02;MID([@Name];1;1))>0;0);MID([@Name];2;1)<(CHAR(CODE(9)+1)));MID([@Name];2;1);"")

Has somebody an idea to make it working ...

You may have to change ; to , and , to . according to your local.

1条回答
Lonely孤独者°
2楼-- · 2019-09-06 20:07

stackoverflow.com/questions/15142523/… for part 1. MACRO : to create XML file is the solution written by "nonprogrammer" – kris Aug 25 '14 at 16:21

查看更多
登录 后发表回答