|
自力で下記の所まで実装しましたが、実行すると←の箇所でおちます。
Imports Excel = Microsoft.Office.Interop.Excel Imports System.Runtime.InteropServices Imports Microsoft.Office.Interop
Dim App As Excel.Application Dim Books As Excel.Workbooks = Nothing Dim Book As Excel.Workbook = Nothing Dim Sheets As Excel.Sheets = Nothing Dim Sheet As Excel.Worksheet = Nothing Dim intX As Integer = 0 Dim blnFlg As Boolean = False
App = New Excel.Application() Book = App.Workbooks.Open(strPath) 'ファイルを開く Sheet = DirectCast(Sheets.Item(1), Excel.Worksheet) <----おちる
Dim cells = Sheet.Cells Dim tl = DirectCast(cells(Sheet.Rows.Count, 1), Excel.Range) Dim br = tl.End(Excel.XlDirection.xlDown) intY = br.Row intX = tl.Column Dim range = Sheet.Range(tl, br) ' 範囲取得 arrData = DirectCast(range.Value, Object(,))
型がおかしいのでしょうか? それとも、根本的に間違っているのでしょうか?
よろしくお願いします
|