VBS删除文件夹?如何传递值从函数中删除?

时间:2014-04-01 01:57:40

标签: vbscript hta

这是我的HTA中包含vbs的一部分。它浏览目录树并获取文件夹。然后文件夹路径将在文本框submitted中,然后通过单击HTA中的按钮删除该文件夹。但它继续向我显示错误@最后一行fso.DeleteFolder(PickFolder_Delete) 我不知道如何将值从delete

传递给function
Sub ChooseCancelFolder_OnClick()
    strStartDir = "\\fs-02\Data\"
    Submitted.txtFile.value = PickFolder_Delete(strStartDir)
End Sub 

Function PickFolder_Delete(strStartDir)
Dim SA, F
Set SA = CreateObject("Shell.Application")
Set F = SA.BrowseForFolder(0, "Choose a folder", 0, strStartDir)
If (Not F Is Nothing) Then
  PickFolder_Delete = F.Items.Item.path
End If
Set F = Nothing
Set SA = Nothing
End Function 

Sub DeleteAFolder_OnClick()
   Dim fso
   Set fso = CreateObject("Scripting.FileSystemObject")
   fso.DeleteFolder(PickFolder_Delete)
End Sub

0 个答案:

没有答案