I have a macro (Loop through files in a folder using VBA?) that looks inside a folder for zip files, but the problem is that the last zip file has an empty string as a name. How can I avoid that error.
The code for the macro:
Sub LoopThroughFiles()
    ' Define variables
    Dim file As String, folder As String
    ' Define working directory
    folder = "C:\Users\cportocarrero\Desktop\Curvas\"
    ' Define type of file to search for
    file = Dir(folder & "*.zip")
    ' Loop through all the files
    Do While Len(file) > 0
        Debug.Print file
        file = Dir
        MsgBox file
    Loop
End Sub
 
     
    