ورود

View Full Version : آموزش: خوانن اطلاعات فایل Excel رمزگذاری شده



ROSTAM2
دوشنبه 26 شهریور 1403, 10:57 صبح
سلام

برای خواندن اطلاعات فایل Excel رمزگذاری شده می شه از این روش استفاده کرد و جواب می ده و البته کاربر باید رمز رو داشته باشه:


'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


Open a password-protected Excel workbook - ConnectionStrings.com (https://www.connectionstrings.com/how-to-open-password-protected-excel-workbook/)