使用VB.NET和Interop的Excel XML导入 [英] Excel XML Import using VB.NET and Interop
本文介绍了使用VB.NET和Interop的Excel XML导入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好
我正在尝试将XML文件导入Excel,然后将数据导出为CSV.记录宏时,我在Excel中手动执行了导入数据"步骤.我基本上是在VB.NET中使用这些命令的.
I am trying to Import an XML file into Excel and then Export the data to CSV. I did the Import Data steps manually in Excel while recording a Macro. I am basically using those commands in VB.NET.
Try
xlWBook.XmlImport(filename, Nothing, True, xlRange.Cells(1, 1))
xlWBook.SaveAs(outFile, xlCSV, False)
xlWBook.Close(False)
xlApp.Quit()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
I am geting an 'Object ref not set to an instance of an Object' exception on the XmlImport method.
I think it is looking for an XMLMap rather than Nothing.
Thanks for any ideas
MisterT99
MisterT99
推荐答案
Did您创建xlWBook的新实例?
Did you create a new instance of xlWBook?
slWBook =新的ExcelWorkbook
slWBook = New ExcelWorkbook
亚当
这篇关于使用VB.NET和Interop的Excel XML导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文