I have been using the querytable command within excel to access a user-defined website. If the user inputs an invalid web address, the macro I'm using fails on the querytables part. I have included the code below. Does anyone know of a method that will allow the macro to "check" to ensure that the webaddress is valid before doing the query? In an ideal world the user could then input a correct address.
website = "URL;
'I'd like to do the check here ----- <
With ActiveSheet.QueryTables.Add(Connection:=website, Destination:=Range("a1"))
.BackgroundQuery = True
.TablesOnlyFromHTML = True
.Refresh BackgroundQuery:=False
.SaveData = True
End With
I really appreciate your help. I am new to TT so please let me know if I have made some egregious error. Thanks again. -P
website = "URL;
'I'd like to do the check here ----- <
With ActiveSheet.QueryTables.Add(Connection:=website, Destination:=Range("a1"))
.BackgroundQuery = True
.TablesOnlyFromHTML = True
.Refresh BackgroundQuery:=False
.SaveData = True
End With
I really appreciate your help. I am new to TT so please let me know if I have made some egregious error. Thanks again. -P