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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Help Setting With Block (Err 91)

Status
Not open for further replies.

Fattire

Technical User
Nov 30, 2006
127
US
Need a second pair of eyes this morning.

Why am I getting a 91 with this code?

The public sub CreateEmptyZip works fine (creates empty zip file), but then stepping through I get an error 91 on the With statement. I'm new to all this.

Code:
    CreateEmptyZip zippath

    Dim ZipApp As Object
    Set ZipApp = CreateObject("Shell.Application")

    With ZipApp
        .Namespace(zippath).CopyHere (strpath)

    End With

    End If
End Sub
 
I'm guessing it's because you are using late binding. Maybe this would work:
Code:
    Dim ZipApp As Shell.Application    
    Set ZipApp = New Shell.Application

 
What about this ?
Dim ZipApp As Object, ZipFold As Object
Set ZipApp = CreateObject("Shell.Application")
Set ZipFold = ZipApp.Namespace(zippath)
ZipFold.CopyHere strpath

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
That did it brother! Thank you Joe. Here's what it ended up as:

Code:
    Dim ZipApp As Shell
    Set ZipApp = New Shell

    With ZipApp
        .Namespace(zippath).CopyHere (strpath)

    End With
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top