I've tried using the following but it is returning the names alphabetically any ideas on how to get the first sheet in the workbook's name without using the excel object?
vb Code:
Dim objConn As OleDb.OleDbConnection Dim dt As DataTable = Nothing Try objConn = Connect() dt = objConn.GetOleDbSchemaTable(OleDb.OleDbSchemaGuid.Tables, Nothing) Close(objConn) Return dt.Rows(0).Item("TABLE_NAME").ToString.Replace("''", "'") Catch ex As Exception Return Nothing Finally If Not dt Is Nothing Then dt.Dispose() End If If Not objConn Is Nothing Then Close(objConn) End If End Try




Reply With Quote