我的代码中有一个空异常错误,我不明白为什么。
我在“资源”中的项目中添加了一个名为“FilterXpath”的 excel 文件。我有以下代码:
Dim FilterXpath As Microsoft.Office.Interop.Excel.Application
Dim w As Microsoft.Office.Interop.Excel.worksheet
Dim sheet As Worksheet
w = FilterXpath.Workbooks.Open("C:\Users\sridevi\Documents\Visual Studio 2008\Projects\WindowsApplication2\WindowsApplication2\Resources\FilterXpath.xlsx")
''I got null exception here stating that FilterXpath is used before it has been assigned a value.