- Const WINDOW_HANDLE = 0
- Const OPTIONS = 0
- Dim objShell,objFolder,FolderPath,pw,wk,EAPP,FSO,FSOFolder,FSOFile
- '获取Excel文件所在文件夹路径
- Set objShell = CreateObject("Shell.Application")
- Set objFolder = objShell.BrowseForFolder(WINDOW_HANDLE, "Select a folder:", OPTIONS,"")
- If objFolder Is Nothing Then
- Wscript.Quit
- End If
- FolderPath =objFolder.Self.Path
- PW=Inputbox("请输入密码","批量去除密码")
- if len(PW)=0 then Wscript.Quit
- Set EAPP=CreateObject("Word.Application")
- Set FSO=CreateObject("Scripting.FileSystemObject")
- Set FSOFolder=FSO.GetFolder(FolderPath)
- For Each FSOFile in FSOFolder.Files
- If instr(Fsofile.Name,".doc") then
- Set wk=EAPP.Documents.Open(FSOFile.Path,,,,pw)
- wk.Password=""
- wk.Close True
- End If
- Next
- EAPP.Quit
复制代码
|