我正在尝试使用VB解决方案中的引用管理器添加对Excel对象库的引用。当我尝试添加引用时没有任何反应。此时我的代码中断了。添加引用时我缺少什么?
通过点击其他表单中的按钮来调用此会计表单。
这是我的代码。
'Imports Excel = Microsoft.Office.Interop.Excel
Public Class frmAccounting
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As _ System.EventArgs) Handles Button1.Click
MsgBox("You are in button 1 in accounting", _ MsgBoxStyle.OkOnly, "Accounting - Step before")
'Dim xlApp As Excel.Application
'Dim xlWorkBook As Excel.Workbook
'Dim xlWorkSheet As Excel.Worksheet
'Dim range As Excel.Range
'Dim rCnt As Integer
'Dim cCnt As Integer
'Dim Obj As Object
'xlApp = New Excel.ApplicationClass
'xlWorkBook = xlApp.Workbooks.Open("\accountsreceivable.xlsx")
'xlWorkSheet = xlWorkBook.Worksheets("sheet1")
'range = xlWorkSheet.UsedRange
'For rCnt = 1 To range.Rows.Count
'For cCnt = 1 To range.Columns.Count
'Obj = CType(range.Cells(rCnt, cCnt), Excel.Range)
'MsgBox(Obj.value)
'Next
'Next
'xlWorkBook.Close()
'xlApp.Quit()
'releaseObject(xlApp)
'releaseObject(xlWorkBook)
'releaseObject(xlWorkSheet)
MsgBox("You are in button 1 in accounting", _ MsgBoxStyle.OkOnly, "Accounting - Step after")
End Sub
End class