Can anyone please help me to make the NameSpace line in the code below work properly? Do I have to declare it, or define it in any way, or make a Reference?
I always get r-time error 91: "Object variable not set or With block not set"
any suggestions, ideas or advice gratefully received.
I always get r-time error 91: "Object variable not set or With block not set"
any suggestions, ideas or advice gratefully received.
Code:
Public Function Unzip(DefPath, Fname)
'Unzips A File
'Fname must be FULL Path\Filename.zip
'DefPath must be valid Path you want to Unzip file TO
Dim FSO As Object
Dim oApp As Object
On Error GoTo UnZip_Err:
Set oApp = CreateObject("Shell.Application")
'Copy the files in the newly created folder
[b]oApp.Namespace(DefPath).CopyHere oApp.Namespace(Fname).items [/b]
On Error Resume Next
Set FSO = CreateObject("scripting.filesystemobject")
FSO.deletefolder Environ("Temp") & "\Temporary Directory*", True
Set oApp = Nothing
Set FSO = Nothing
Exit Function