Im making a macro on excel that import data from MySQL (with querytables.add and using OBCD) and every time i run the macro it creates a new connection and its a waste of time and space. Is there a function to know if a cell/sheet has a connection on it so i dont have to import the data again and create a new connection or a code to know when was the last time the connection was refreshed.

i looked up for something but it seems there is nothing like it, so maybe and alternative way to do it will be useful, thanks!

Code:

```
Worksheets("Hoja1").Activate

Dim sqlstring As String
Const connstring As String = "ODBC;DSN=blabla;UID=blabla;PWD=blabla"

if "***Range("A1") has a connection***" then
    ActiveWorkbook.Connections("Conexión").Refresh 'actualize the connection previously made
Else 'import the table from sql server
    sqlstring = vbNullString
    sqlstring = "SELECT * FROM ExTable WHERE year > '2012'"
    With ActiveSheet.QueryTables.Add(Connection:=connstring, Destination:=Range("A1"), Sql:=sqlstring)
        .RefreshStyle = xlOverwriteCells
        .Refresh BackgroundQuery:=False
    End With

```