EXCEL导出为指定的XML

EXCEL导出为指定的XML

ID:38467706

大小:129.50 KB

页数:3页

时间:2019-06-13

EXCEL导出为指定的XML_第1页
EXCEL导出为指定的XML_第2页
EXCEL导出为指定的XML_第3页
资源描述:

《EXCEL导出为指定的XML》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、导出前的EXCEL导出后的XML格式DimxmldocAsDOMDocumentDimverAsVariant'DimColAsIntegerDimRowAsIntegerDimiAsIntegerDimjAsIntegerDimkAsIntegerPrivateSubSaveAsXML_Click()Row=Application.WorksheetFunction.CountA(Columns("E"))'MsgBoxCells(1,1).ValueSetxmldoc=NewDOMDocumentSetver=xmldoc.cr

2、eateProcessingInstruction("xml","version="&Chr(34)&"1.0"&Chr(34)&"encoding=""gb2312""")xmldoc.appendChildverSetDeliverynode=xmldoc.createElement("Delivery")xmldoc.appendChildDeliverynodeFori=2ToRow-1IfIsEmpty(Cells(i,"C"))=FalseThenSetOrdernode=xmldoc.createElement("订单

3、")CreateAttributeOrdernode,"单据编号",Cells(i,"C")Deliverynode.appendChildOrdernodeCreateNodeOrdernode,"购货单位",Cells(i,"B")CreateNodeOrdernode,"日期",Cells(i,"A")SetDetailnode=xmldoc.createElement("Detail")Ordernode.appendChildDetailnodeIfIsEmpty(Cells(i,"C"))=FalseThenSetCat

4、alognode=xmldoc.createElement("Catalog")CreateAttributeCatalognode,"规格型号",Cells(i,"D")Detailnode.appendChildCatalognode'CreateNodeCatalognode,"规格型号",Cells(i,"D")CreateNodeCatalognode,"数量",Cells(i,"E")SetBarcodenode=xmldoc.createElement("Barcode")Catalognode.appendChild

5、BarcodenodeIfCells(i,6).Value="ok"OrCells(i,6).Value="OK"ThenCreateNodeBarcodenode,"编码",Cells(i,"F")ElseFork=1ToCells(i,5).ValueCreateNodeBarcodenode,"编码",Cells(i,k+5)NextEndIfForj=i+1ToRow-1IfIsEmpty(Cells(j,"C"))=TrueThenSetCatalognode=xmldoc.createElement("Catalog")

6、CreateAttributeCatalognode,"规格型号",Cells(j,"D")Detailnode.appendChildCatalognodeCreateNodeCatalognode,"数量",Cells(j,"E")SetBarcodenode=xmldoc.createElement("Barcode")Catalognode.appendChildBarcodenodeIfCells(j,6).Value="ok"OrCells(j,6).Value="OK"ThenCreateNodeBarcodenode

7、,"编码",Cells(j,"F")ElseFork=1ToCells(j,5).ValueCreateNodeBarcodenode,"编码",Cells(j,k+5)NextEndIfElsei=j-1ExitForEndIfNextEndIfEndIfNextxmldoc.save"C:DocumentsandSettingsAdministrator桌面转换后.xml"EndSubPrivateSubCreateNode(ByValparentAsIXMLDOMNode,ByValnodenameAsString,B

8、yValvalNodeAsString)DimnewnodeAsIXMLDOMNodeSetnewnode=parent.ownerDocument.createElement(nodename)newnode.Text=valNod

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。