|
Open the Excel workbook to prompt for the password
Dim xl As Object
Set xl = GetObject(CurrentProject.Path & "\" & "MASTER JAN 2009.xls")
'Now open the workbook to read/write/whatever
Dim cnn1 As New ADODB.Connection
Dim rst1 As ADODB.Recordset
Dim strExcelName As String = "MASTER JAN 2009.xls"
Dim strWkBkName As String = "[MASTER 2008$]"
cnn1.Open "Provider=Microsoft.Jet.OLEDB.4.0;" _
"Data Source=" & CurrentProject.Path & "\" & strExcelName & ";" _
"Extended Properties=""Excel 8.0;"";"
Set rst1 = New ADODB.Recordset
rst1.Open strWkBkName, cnn1, , , adCmdTable
Do Until rst1.EOF
'process your data here
rst1.MoveNext
Loop |
|