I
Ivan
Hi All,
I have tried to automate excel in vb.net
and i found a problem that i can't find the solution in anywhere...
i hope someone can help me in this group....
the problem is i try using the excel function --
'Excel.Workbooks.Open("C:\Filename.xls")'
it pops up an error msg -- 'object reference not set to an instance of an
object'
Source code as folllow
Dim objExcel As Excel.Application
Dim objWorkBook As Excel.Workbook
objExcel = CType(CreateObject("Excel.Application"),
Excel.Application)
Dim objOldCI As System.Globalization.CultureInfo =
System.Threading.Thread.CurrentThread.CurrentCulture
System.Threading.Thread.CurrentThread.CurrentCulture = New
System.Globalization.CultureInfo("en-US")
fail==> objWorkBook = objExcel.Workbooks.Open(strFileName)
System.Threading.Thread.CurrentThread.CurrentCulture = objOldCI
Does anyone know the solution??.... please guide me into the right
direction...Thanks
cheers,
Ivan
I have tried to automate excel in vb.net
and i found a problem that i can't find the solution in anywhere...
i hope someone can help me in this group....
the problem is i try using the excel function --
'Excel.Workbooks.Open("C:\Filename.xls")'
it pops up an error msg -- 'object reference not set to an instance of an
object'
Source code as folllow
Dim objExcel As Excel.Application
Dim objWorkBook As Excel.Workbook
objExcel = CType(CreateObject("Excel.Application"),
Excel.Application)
Dim objOldCI As System.Globalization.CultureInfo =
System.Threading.Thread.CurrentThread.CurrentCulture
System.Threading.Thread.CurrentThread.CurrentCulture = New
System.Globalization.CultureInfo("en-US")
fail==> objWorkBook = objExcel.Workbooks.Open(strFileName)
System.Threading.Thread.CurrentThread.CurrentCulture = objOldCI
Does anyone know the solution??.... please guide me into the right
direction...Thanks
cheers,
Ivan