Add a reference to the Excel object library...
This function interogates a given file("c:\temp\file.xls")
, sheet("Sheet1"), and cell("A1"), just to give you an idea... I have returned the string (.Text) but you can amend this to return .Formula or .NumberType etc...
Text1.Text = GetExcelSpeadsheetCellValu
Public Function GetExcelSpeadsheetCellValu
ByVal strSheetName As String, ByVal strCell As String) As String
On Error GoTo GetExcelSpeadsheetCellValu
Dim objExcel As Excel.Application
Dim objBook As Excel.Workbook
Dim strCellName As String
Set objExcel = New Excel.Application
objExcel.Visible = False
objExcel.DisplayAlerts = False
Set objBook = objExcel.Workbooks.Open(Fi
GetExcelSpeadsheetCellValu
objBook.Close SaveChanges:=False
Set objBook = Nothing
objExcel.Quit
Set objExcel = Nothing
Exit Function
GetExcelSpeadsheetCellValu
On Error Resume Next
objBook.Close SaveChanges:=False
Set objBook = Nothing
objExcel.Quit
Set objExcel = Nothing
Exit Function
End Function
Hope that helps...
R
Main Topics
Browse All Topics





by: dustybrynPosted on 2002-07-29 at 09:10:06ID: 7185690
When you say data type what exactly do you mean? Do you for instance want to distinguish text from numbers are you after the cell format?