Hello all,
I'm trying to make a script that deletes a folder when I click a button. I'm using below code where the * translates to a weeknumber. At least, it should.
If I change the * to the weeknumber (e.g. "Week 27") the folder is deleted.
I think I'm using the wrong build-up with the wildcard, but I can't seem to find the correct way... Anybody able to help me out here?
I'm trying to make a script that deletes a folder when I click a button. I'm using below code where the * translates to a weeknumber. At least, it should.
If I change the * to the weeknumber (e.g. "Week 27") the folder is deleted.
I think I'm using the wrong build-up with the wildcard, but I can't seem to find the correct way... Anybody able to help me out here?
Code:
Dim FSO As Object
Dim MyPath As String
Set FSO = CreateObject("scripting.filesystemobject")
MyPath = "[I]pathname[/I]\Week [B]*[/B]\" '<< Change
If Right(MyPath, 1) = "\" Then
MyPath = Left(MyPath, Len(MyPath) - 1)
End If
If FSO.FolderExists(MyPath) = False Then
MsgBox MyPath & " doesn't exist"
Exit Sub
End If
FSO.deletefolder MyPath