I don't know if this is the right place to ask or not...so here it goes...
I have an excel spreadsheet with a macro that refreshes data which is pulled from an external data source, which happens to be Access Database Query which pulls data from an SQL Server DB - when there is an ODBC Failure - all other reports that are scheduled get hung up - is there a way to force the application to quit if there is an ODBC Failure/Timeout? Or any other errors for that matter - so the other reports are free to run? - Or is there away to force the macro's to restart until they run sucessfully?
The macro I currently have is as follows:
Thanks in advance for any help!
Sophie
I have an excel spreadsheet with a macro that refreshes data which is pulled from an external data source, which happens to be Access Database Query which pulls data from an SQL Server DB - when there is an ODBC Failure - all other reports that are scheduled get hung up - is there a way to force the application to quit if there is an ODBC Failure/Timeout? Or any other errors for that matter - so the other reports are free to run? - Or is there away to force the macro's to restart until they run sucessfully?
The macro I currently have is as follows:
Code:
Private Sub Workbook_Open() Sheets("DATA - DO NOT TOUCH!").Select ' "An Attempt to Refresh" Tag' Sheets("DATA - DO NOT TOUCH!").Select Range("N2").Select ActiveCell.FormulaR1C1 = "=NOW()" Range("N2").Select Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False ActiveWorkbook.Save ActiveWorkbook.RefreshAll Sheets("DATA - DO NOT TOUCH!").Select Range("N5").Select ActiveCell.FormulaR1C1 = "=NOW()" Range("N5").Select Selection.Copy Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False Sheets("Current Rotation").Select Range("a1").Select ActiveWorkbook.Save Application.Quit End Sub
Sophie