A
Aposto
I have a routine which opens various Excel files and then imports the data in
to Access:
Sub OpenExcelConn(conn As ADODB.Connection, rst As ADODB.Recordset, FileName
As String, SheetName As String)
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" &
FileName & ";" & "Extended Properties='Excel 8.0;HDR=Yes;IMEX=1'"
rst.CursorLocation = adUseClient
rst.Open "[" & SheetName & "$]", conn, adOpenStatic, adLockOptimistic
End Sub
I have recently added some excel files with passwords to open them and they
obviously fail the above code. How can I modify the code to open Excel files
with or with out passwords?
to Access:
Sub OpenExcelConn(conn As ADODB.Connection, rst As ADODB.Recordset, FileName
As String, SheetName As String)
conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" &
FileName & ";" & "Extended Properties='Excel 8.0;HDR=Yes;IMEX=1'"
rst.CursorLocation = adUseClient
rst.Open "[" & SheetName & "$]", conn, adOpenStatic, adLockOptimistic
End Sub
I have recently added some excel files with passwords to open them and they
obviously fail the above code. How can I modify the code to open Excel files
with or with out passwords?