1
打開一個密碼保護的Word文檔,我需要打開VBA 密碼保護的Word文檔時它被要求輸入密碼,如何通過代碼打開 代碼:在VBA
Dim DPDoc
Dim DPApp
Dim DPPath
DPPath = "C:\MyFolder\PwdProtectdFile.docx"
Set DPApp = CreateObject("word.Application")
' It is asking for the password here
DPDoc = DPApp.Documents.Open(DPPath)
我得到運行時錯誤 '448' 「命名找不到參數」 因此,我更改爲 DPDoc = DPApp.Documents.Open(DPPath,Password = YourOwnPassword) 現在它仍在提示輸入密碼。似乎沒有考慮到這一點。任何人都可以請幫忙 –
@udhayakumar:我的不好,因爲它似乎應該是'PasswordDocument'而不僅僅是'Password'!查看編輯 – R3uK