EXCEL,通过vba代码从表中的数据创建一个XML文件 [英] EXCEL, create a XML-file from a data in table via vba code
问题描述
EXCEL
文件luxom2xlm可从
表luxom_input,表T_LuxomInput,
- $
-
在O - KAST列中
= IF(AND(IFERROR(FIND(start_02; MID([@ Name]; 1; 1))大于0; 0); MID ([@Name]; 2; 1) - ;(CHAR(CODE(9)1))); MID([@名称]; 2; 1); )
= CONCATENATE([@ [ networkID]]; address; [@ [groupID]]; address; TEXT([@ [HexAddress]];00))
有人想让它工作...
您可能需要将;
更改为,
和,
c $ c根据您的本地。
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
(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
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
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.
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
这篇关于EXCEL,通过vba代码从表中的数据创建一个XML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!