Excel VBA - Avoiding error in WEB Queries.

  • I am using web queries to fetch the data as :



    With Worksheets("sheet4").QueryTables.Add(Connection:= _
    address_string _
    , Destination:=Worksheets("sheet4").Range("A1"))
    '.Name = "quotesearch.jsp?companyname=gail&series=EQ&flag=0"
    On Error GoTo errorhandler
    .FieldNames = True
    .RowNumbers = False
    .FillAdjacentFormulas = False
    .PreserveFormatting = True
    .RefreshOnFileOpen = False
    .BackgroundQuery = True
    .RefreshStyle = xlInsertDeleteCells
    .SavePassword = False
    .SaveData = True
    .AdjustColumnWidth = True
    .RefreshPeriod = 0
    .WebSelectionType = xlAllTables
    .WebFormatting = xlWebFormattingNone
    .WebPreFormattedTextToColumns = True
    .WebConsecutiveDelimitersAsOne = True
    .WebSingleBlockTextImport = False
    .WebDisableDateRecognition = False
    .Refresh BackgroundQuery:=False
    End With


    where address_string is my website address.


    some times when internet ( as I am using proxy ) is down then it is displaying the error message that could not open the specified page . I want to suppress this message ( I don't want the message box to pop up with this error and instead want to continue with the next set of statements ) Where I have to put the error handling routine in the code .


    Also when this thing is fetching the data the excel is hanged, Can I avoid this hanging of Excel application by making some changes in the parameters.