Øyvind
2006-11-09 20:15:02 UTC
I am learning VB2005 and interoptibility with Excel. I have some experience
from VB6, but VB2005 is new to me.
the project hav reference to MS excel 11
Imports Microsoft.Office.Interop
Imports Excel = Microsoft.Office.Interop.Excel
'' Program starts and loads up an Excel workbook and
the problem starts when i tries to access a cell i Excel.
Dim MyFileName As String = ""
Dim MyResFrom_Xls_WB As String = ""
Dim ActualRow As Integer = 10
Dim ActualCol As Integer = 10
Dim xls_App As New Excel.Application
Dim xls_wb As Excel.Workbook
Dim xls_Sheet As Excel.Worksheet = Nothing
' Dim xls_Range As Microsoft.Office.Interop.Excel.Range
MyFileName = Me.fbxSalgstall.Path + "\" + Me.txtFileNavn.Text
xls_App = New Excel.Application()
xls_wb = xls.Workbooks.Open(MyFileName)
xls_App.Visible = True
MyResFrom_Xls_WB = xls_Sheet.Cells(ActualRow, ActualCol) ' = Error;
Object reference not set to an instance of an object.
MessageBox.Show(MyResFrom_Xls_WB)
End Sub
If somebody have a proposal. This code with rfrence to a cell was running
inside a VSTO project.
If somebody have any proposal ? I am happy :-)
from VB6, but VB2005 is new to me.
the project hav reference to MS excel 11
Imports Microsoft.Office.Interop
Imports Excel = Microsoft.Office.Interop.Excel
'' Program starts and loads up an Excel workbook and
the problem starts when i tries to access a cell i Excel.
Dim MyFileName As String = ""
Dim MyResFrom_Xls_WB As String = ""
Dim ActualRow As Integer = 10
Dim ActualCol As Integer = 10
Dim xls_App As New Excel.Application
Dim xls_wb As Excel.Workbook
Dim xls_Sheet As Excel.Worksheet = Nothing
' Dim xls_Range As Microsoft.Office.Interop.Excel.Range
MyFileName = Me.fbxSalgstall.Path + "\" + Me.txtFileNavn.Text
xls_App = New Excel.Application()
xls_wb = xls.Workbooks.Open(MyFileName)
xls_App.Visible = True
MyResFrom_Xls_WB = xls_Sheet.Cells(ActualRow, ActualCol) ' = Error;
Object reference not set to an instance of an object.
MessageBox.Show(MyResFrom_Xls_WB)
End Sub
If somebody have a proposal. This code with rfrence to a cell was running
inside a VSTO project.
If somebody have any proposal ? I am happy :-)
--
Øyvind
Øyvind