Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Attempting to delete folder - receiving error

Status
Not open for further replies.

kdjonesmtb2

Technical User
Nov 19, 2012
93
US
Receiving the following error:

Path not found

Line (681): "objFSO.DeleteFolder strFolderPath, True".


If objRadioButton3.checked then
msgbox "You have selected the option to delete the files in the archive"



Dim Input5
Input5 = InputBox("Input Archive Folder Name to delete")
MsgBox ("You entered: " & Input5)



Dim strFolderPath

strFolderPath= "\\ikanas267\Documents\kgittensjones\My Documents\QTP 834\" & Input5 &"\"

msgbox(strFolderPath)'string is populated with path




Dim objFSO
Set objFSO = CreateObject ("Scripting.FileSystemObject")
If objFSO.FolderExists(strFolderPath) Then
objFSO.DeleteFolder strFolderPath, True
End If
Set objFSO = Nothing


End if
 
Actually, it's the opposite of the problem you had the other day with "MoveFile". In this case, the folder you are deleting with DeleteFolder cannot have a trailing backslash.

So, leave the trailing backslash off. When you need it (like when using MoveFile), just append a "\" to the end.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top