0
我有多個Word文檔,這些文檔需要對開發人員模式施加的限制。使用VBA解除文件夾內的多個Word文檔
我使用WScript的一個文件夾傳遞作爲參數運行腳本,但陣痛錯誤
Dim strFolder
Const xlTypePDF = 0
strFolder = WScript.Arguments(0)
if Wscript.Arguments.Count > 0 Then
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWord = CreateObject("Word.Application")
Set objFolder = objFSO.GetFolder(strFolder)
For Each Fil In objFolder.Files
Set objFile = objFSO.GetFile(Fil)
Set objDoc = objWord.Documents.Open(Fil,,TRUE)
dirPath = objFSO.GetParentFolderName(objFile)
fileBaseName = objFSO.GetBaseName(objFile)
'objWord.ActiveDocument.Unprotect Password:="pwd"
objWord.ActiveDocument.Close(False)
Next
objWord.Quit
Else
Msgbox("Run usning cmd")
End If
它拋出什麼錯誤,以及在哪一行? –
https://stackoverflow.com/questions/42194300/does-vbscript-allow-named-arguments-in-function-calls –
錯誤的文字是什麼? –