I currently have an issue trying to open PW protected file.
My question is this: "Has anyone successfully opened either and XLS or XLSM file with ADO?" AND not had to actually open the workbook up in code first?
Everything runs fine without a PW.
I've tried moving the password location in the connection string to different spots in the string. I've removed the HDR and IMEX.
Nothing seems to work.
My question is this: "Has anyone successfully opened either and XLS or XLSM file with ADO?" AND not had to actually open the workbook up in code first?
Everything runs fine without a PW.
I've tried moving the password location in the connection string to different spots in the string. I've removed the HDR and IMEX.
Nothing seems to work.
VBA Code:
Private Function GetConnectionString(nFilePath As String, nWithPassword As Boolean) As String
Dim nPw As String
nPw = IIf(nWithPassword, "Jet OLEDB:Database Password=" & Core.ProtectionPassword & ";", "")
GetConnectionString = _
"Provider=Microsoft.ACE.OLEDB.12.0;" _
& "Data Source=" & nFilePath & ";" & nPw _
& "Extended Properties='Excel 12.0 Xml;HDR=NO;IMEX=1';"
End Function