2017-06-01 228 views
0

我想連接受密碼保護的訪問。請告知我在哪裏可以通過密碼參數在下面的編碼。連接受密碼保護的文件

With Acon1 
    .Provider = "Microsoft.ACE.OLEDB.12.0" 
    .ConnectionString = "Data Source=" + ThisWorkbook.Sheets(1).Range("V24").Value 
    .Open 
End With 

With Rs1 
    .CursorLocation = adUseClient 
    .CursorType = adOpenDynamic 
    .LockType = adLockOptimistic 
    .ActiveConnection = Acon1 
    .Source = "Select * from Headcount where [Employee ID]=" & myvalue0l 
    .Open 
End With 

回答

0

嘗試:

With Acon1 
    .Provider = "Microsoft.ACE.OLEDB.12.0" 
    .ConnectionString = "Data Source=" + ThisWorkbook.Sheets(1).Range("V24").Value & _ 
";User ID=admin;Password=" 'Password 
    .Open 
End With