Hi All,

I am running a series of macros including 4 downloads - when I run the series I am getting a run time 1004 error with the download but when I then go to debug there is nothing wrong with the code and it runs normally when I click play. Is there a line of code I can put in to catch the error and repeat the code rather than having to go into vba everytime?

The download is essential so I do not want to skip over it I just want it to be repeated until it works.


My code is;


Sub Download_L2C()

Dim strFileName As String
Dim strFilePath As String


strFilePath = "file"
strFileName = "L2C.xlsx"
Workbooks.Open Filename:="" & strFilePath & "" & strFileName & ""
ActiveWorkbook.SaveCopyAs CreateObject("Wscript.shell").specialfolders("Desktop") & "\Source Data\" & "L2C.xlsx"
ActiveWorkbook.Close savechanges:=False

Close


End Sub