Excel: handle error on data connection refresh
I have an Excel file with a data connection (olap cube), sometimes I can refresh it, but sometimes, randomly the refresh fails (maybe the data source is temporarily not available, I don't know why and unfortunately I don't have admin rights on this Microsoft SQL Server) and I receive these popups (Analysis Services wizard):
1 I click OK
2 I click Cancel
3 I click OK, then I try again to refresh successfully.
I need to run the refresh with a macro. So I call a refresh using vba and sometimes the connection fails (like when I manually refresh), I don't get any error in the code but the popups appear. How can I handle those manual 3 steps above using vba?