Application.DisplayAlerts = False not working (1 Viewer)

smiler44

Registered User.
Local time
Today, 22:52
Joined
Jul 15, 2008
Messages
641
for some reason this line of code is not working
Application.DisplayAlerts = False

when the line of code below runs i still get the alert about do i want to copy.

oApp.Namespace(FileNameFolder).CopyHere oApp.Namespace(Fname).items

why am I still getting the alert? if this is the wrong code, what is the right code please?

thanks smiler44

Code:
Sub extract()

    Dim FSO As Object
    Dim oApp As Object
    Dim Fname As Variant
    Dim FileNameFolder As Variant
    Dim DefPath As String
Application.DisplayAlerts = False
                                        
    Fname = "C:\Users\Downloads\443.zip"
    If Fname = False Then
        'Do nothing
    Else
        'Destination folder
        DefPath = "C:\Users\documents\adsl"
        If Right(DefPath, 1) <> "\" Then
            DefPath = DefPath & "\"
        End If
        FileNameFolder = DefPath
        'Extract the files into the Destination folder
        Set oApp = CreateObject("Shell.Application")
        oApp.Namespace(FileNameFolder).CopyHere oApp.Namespace(Fname).items
       ' MsgBox "You find the files here: " & FileNameFolder
        On Error Resume Next
        Set FSO = CreateObject("scripting.filesystemobject")
        FSO.deletefolder Environ("Temp") & "\Temporary Directory*", True
    End If
    
    Application.DisplayAlerts = True
    
End Sub
 

Rx_

Nothing In Moderation
Local time
Today, 15:52
Joined
Oct 22, 2009
Messages
2,803
There can be a case where an untrapped error will cause this.
Please add at the top
On Error Goto errTrap


and at the bottom add this to the end sub


Exit Sub
errTrap:
Msgbox " the error reported is " & err.number & " " & err.Description
End Sub ' don't repeat the end sub, this is just for your reference.


also, please comment out your On Error Resume Next

Run this again and see if there are no errors
 

smiler44

Registered User.
Local time
Today, 22:52
Joined
Jul 15, 2008
Messages
641
thanks RX- I did not even see the on error resume next
I give your code3 a go to see what I get.
I wont be able to reply for a while it's not I cant be bothered, its because I cant

thanks again
smiler44
 

smiler44

Registered User.
Local time
Today, 22:52
Joined
Jul 15, 2008
Messages
641
RX_ just came back to post my findings, only to find I have not followed you instructions fully. I'm going to go away and try again:mad:

smiler44
 

Users who are viewing this thread

Top Bottom