My code to export a table into excel SUDDENLY stopped working.

  • This code was working fine this morning but now it does not work. It used to pull data from a website from all the years of recorded data into a sheet. Now it stopped working. There seems to be no problem with the code but still no luck. No idea why this happned out of no where.


    Any help would be appreciated.


    With ActiveSheet.QueryTables.Add(Connection:= _
    "URL;https://www.treasury.gov/resou…xtView.aspx?data=yieldAll" _
    , Destination:=Range("$A$1"))
    .Name = "TextView.aspx?data=yieldAll"
    .FieldNames = True
    .RowNumbers = False
    .FillAdjacentFormulas = False
    .PreserveFormatting = True
    .RefreshOnFileOpen = False
    .BackgroundQuery = True
    .RefreshStyle = xlInsertDeleteCells
    .SavePassword = False
    .SaveData = True
    .AdjustColumnWidth = True
    .RefreshPeriod = 0
    .WebSelectionType = xlSpecifiedTables
    .WebFormatting = xlWebFormattingNone
    .WebTables = "69"
    .WebPreFormattedTextToColumns = True
    .WebConsecutiveDelimitersAsOne = True
    .WebSingleBlockTextImport = False
    .WebDisableDateRecognition = False
    .WebDisableRedirections = False
    .Refresh BackgroundQuery:=False
    End With

  • Re: My code to export a table into excel SUDDENLY stopped working.


    It's OK here, just very slow.


    Is it a fresh sheet everytime you use it? If not, perhaps Refresh instead of creating a new query.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!