6 个解决方案
#1
啥意思
直接WorkSheets(i).Name不可以了吗?
直接WorkSheets(i).Name不可以了吗?
#2
呵呵,UPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUP
#3
WorkSheets(i).Name
#4
具体应该怎么做啊?谢谢
#5
我是用在访问这个excel中的,不知道有没有比较简便的方法得到excel的工作表名(这个工作表名是不固定的,用户自己修改成什么就获得什么),还是要用其它一些对象之类的来得到!希望大家能指教一下,我是想力求简便!
Set openExcel = Nothing
Dim DSN As String
Dim sError As String
CurrentImportedFileType = "EXCEL"
On Error GoTo errp
DSN = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source='" + FileName + "';" _
+ "Extended Properties='Excel 8.0;HDR=Yes;IMEX=1'"
Set myDbfCN = New Connection
myDbfCN.CursorLocation = adUseClient
myDbfCN.IsolationLevel = adXactUnspecified
myDbfCN.Open DSN
If Err.Number <> 0 Then
sError = "VBC" & "excel连接失败:" & Err.description
GoTo errp
End If
Set openExcel = New ADODB.Recordset
strSql = "SELECT * FROM [Sheet1$]" '注意,将excel第一个工作表的名称固定!
Set openExcel = Nothing
Dim DSN As String
Dim sError As String
CurrentImportedFileType = "EXCEL"
On Error GoTo errp
DSN = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source='" + FileName + "';" _
+ "Extended Properties='Excel 8.0;HDR=Yes;IMEX=1'"
Set myDbfCN = New Connection
myDbfCN.CursorLocation = adUseClient
myDbfCN.IsolationLevel = adXactUnspecified
myDbfCN.Open DSN
If Err.Number <> 0 Then
sError = "VBC" & "excel连接失败:" & Err.description
GoTo errp
End If
Set openExcel = New ADODB.Recordset
strSql = "SELECT * FROM [Sheet1$]" '注意,将excel第一个工作表的名称固定!
#6
参考:....\MSDN98\98VS\2052\SAMPLES\VB98\GeoFacts的演示的源代码。
#1
啥意思
直接WorkSheets(i).Name不可以了吗?
直接WorkSheets(i).Name不可以了吗?
#2
呵呵,UPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUPUP
#3
WorkSheets(i).Name
#4
具体应该怎么做啊?谢谢
#5
我是用在访问这个excel中的,不知道有没有比较简便的方法得到excel的工作表名(这个工作表名是不固定的,用户自己修改成什么就获得什么),还是要用其它一些对象之类的来得到!希望大家能指教一下,我是想力求简便!
Set openExcel = Nothing
Dim DSN As String
Dim sError As String
CurrentImportedFileType = "EXCEL"
On Error GoTo errp
DSN = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source='" + FileName + "';" _
+ "Extended Properties='Excel 8.0;HDR=Yes;IMEX=1'"
Set myDbfCN = New Connection
myDbfCN.CursorLocation = adUseClient
myDbfCN.IsolationLevel = adXactUnspecified
myDbfCN.Open DSN
If Err.Number <> 0 Then
sError = "VBC" & "excel连接失败:" & Err.description
GoTo errp
End If
Set openExcel = New ADODB.Recordset
strSql = "SELECT * FROM [Sheet1$]" '注意,将excel第一个工作表的名称固定!
Set openExcel = Nothing
Dim DSN As String
Dim sError As String
CurrentImportedFileType = "EXCEL"
On Error GoTo errp
DSN = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source='" + FileName + "';" _
+ "Extended Properties='Excel 8.0;HDR=Yes;IMEX=1'"
Set myDbfCN = New Connection
myDbfCN.CursorLocation = adUseClient
myDbfCN.IsolationLevel = adXactUnspecified
myDbfCN.Open DSN
If Err.Number <> 0 Then
sError = "VBC" & "excel连接失败:" & Err.description
GoTo errp
End If
Set openExcel = New ADODB.Recordset
strSql = "SELECT * FROM [Sheet1$]" '注意,将excel第一个工作表的名称固定!
#6
参考:....\MSDN98\98VS\2052\SAMPLES\VB98\GeoFacts的演示的源代码。