V
Varne
Hello!
I have these below given codes that extract data from Excel files without
opening those files. The problem is if those files are password protected
these codes do not work. I tried to fit in the Password:=â€fsgsgâ€(example)
but no use.
Could someone help?
Thanks.
Sub AccessingExcel()
Dim recordset As ADODB.recordset
Dim SQL As String
Dim connectionstring As String
connectionstring = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & ThisWorkbook.Path & "\" & "Book1" & ".xls; " & _
"Extended Properties=Excel 8.0;"
SQL = _
"select * from (B1:B50000)"
Set recordset = New ADODB.recordset
recordset.Open SQL, connectionstring
Cells(1, 1) = recordset.Fields(0)
recordset.Close
End sub
I have these below given codes that extract data from Excel files without
opening those files. The problem is if those files are password protected
these codes do not work. I tried to fit in the Password:=â€fsgsgâ€(example)
but no use.
Could someone help?
Thanks.
Sub AccessingExcel()
Dim recordset As ADODB.recordset
Dim SQL As String
Dim connectionstring As String
connectionstring = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & ThisWorkbook.Path & "\" & "Book1" & ".xls; " & _
"Extended Properties=Excel 8.0;"
SQL = _
"select * from (B1:B50000)"
Set recordset = New ADODB.recordset
recordset.Open SQL, connectionstring
Cells(1, 1) = recordset.Fields(0)
recordset.Close
End sub