none
How do I check if QueryTable connection failed? RRS feed

  • Question

  • Hello,

    How do I check if my QueryTable connection failed?

    Thanks for your help!

    smsemail

    code below:

     With Selection.QueryTables.Add( _
             Connection = "URL;https://pts-2.usps.gov" & URLString1 & URLString2, _
             Destination:=Worksheets("RIPSDetail").Range("A" & DetCount))
             .Name = _
             "tcIntranetTrackingNumResponse?label=" & Label & "&status=Archived&mailingDate=&userSearchTypeChoice=Extensive"
             .WebSelectionType = xlSpecifiedTables
             .WebFormatting = xlWebFormattingNone
             .WebTables = "ripsResultTable"""
             .WebPreFormattedTextToColumns = False
             .WebConsecutiveDelimitersAsOne = True
             .WebSingleBlockTextImport = False
             .WebDisableDateRecognition = False
             .WebDisableRedirections = False
             .Refresh BackgroundQuery:=False
     End With

    Monday, December 22, 2014 3:07 PM

Answers

  • Hi Smeemail,

    In addtion, if the application.DisplayAlerts is set to true, when the connection is failed it would dispaly alert like figure below:

    Hope it is helpful.

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, December 23, 2014 5:54 AM
    Moderator

All replies

  • Do a refresh and then check the resultrange property for the # of rows, etc.

    Unfortunately, with web query types you don't have a refreshdate like with ODBC and OLEDB connection queries.

    Monday, December 22, 2014 8:59 PM
  • Hi Smeemail,

    In addtion, if the application.DisplayAlerts is set to true, when the connection is failed it would dispaly alert like figure below:

    Hope it is helpful.

    Regards & Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, December 23, 2014 5:54 AM
    Moderator