5,139
社区成员
发帖
与我相关
我的任务
分享
Public Function GetSheetName(ByVal bookpath As String) As List(Of String)
Dim lst As New List(Of String)
Dim Str As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & bookpath & ";Extended Properties=""Excel 8.0;HDR=No;IMEX=1;"""
Dim con As New OleDbConnection(Str)
con.Open()
Dim dt As DataTable = con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, New Object() {Nothing, Nothing, Nothing, "TABLE"})
con.Close()
For k As Integer = 0 To dt.Rows.Count - 1
Str = dt.Rows(k)("TABLE_NAME").ToString
If Str Like "*$*" Then '
Str = Str.Replace(" ", "")
Str = Str.Replace("$", "")
lst.Add(Str)
End If
Next k
Return lst
End Function