标题: [问题求助] Excel批量添加密码的VBS代码哪里错了? [打印本页]
作者: ww0000 时间: 2015-1-22 16:09 标题: Excel批量添加密码的VBS代码哪里错了?
这个代码哪错了,通不过!- 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("PowerPoint.Application")
- Set FSO=CreateObject("Scripting.FileSystemObject")
- Set FSOFolder=FSO.GetFolder(FolderPath)
- EAPP.Visible = True
- For Each FSOFile in FSOFolder.Files
- If instr(Fsofile.Name,".ppt") then
- Set wk=EAPP.Presentations.Open(FSOFile.Path,,,,Pw)
- wk.PassWord=""
- EAPP.selection.TypeBackSpace
- wk.SaveAs FSOFile.Path
- wk.close
- End If
- Next
- EAPP.Quit
复制代码
作者: CrLf 时间: 2015-1-22 16:57
给出报错信息
或者自己试着隔几行下个断点,一运行就知道了,断点可以是真断点(vbsedit),也可以是 msgbox 之类的伪断点
作者: ww0000 时间: 2015-1-22 17:03
Set wk=EAPP.Presentations.Open(FSOFile.Path,False,False,False,,,,pw)
这里的密码通不过
作者: ww0000 时间: 2015-1-22 17:04
回复 2# CrLf
Set wk=EAPP.Presentations.Open(FSOFile.Path,False,False,False,,,,pw)
欢迎光临 批处理之家 (http://bathome.net./) |
Powered by Discuz! 7.2 |