Excel宏在某段时间后无效

时间:2017-10-28 07:31:10

标签: excel vba excel-vba

我在Excel中有一个从特定链接获取数据(html表)的宏,该宏可以正常运行4-5次,但之后会得到空白数据。但是如果我再次记录那个宏并且运行它再次正常工作4-5次运行。我该如何解决这个问题?

添加下面的宏(这是录制的宏)

使用ActiveSheet.QueryTables.Add(连接:= _         " URL; HTTP" _         ,目的地:=范围(" $ A $ 3"))         .Name = _         " awadmin命令名= appwatch&安培;?项目= 60115蛇毒&安培; I = 1和M = &安培; Q = &安培; GO =提交"         .FieldNames = True         .RowNumbers = False         .FillAdjacentFormulas = False         .PreserveFormatting = True         .RefreshOnFileOpen = False         .BackgroundQuery = True         .RefreshStyle = xlInsertDeleteCells         .SavePassword = False         .SaveData = True         .AdjustColumnWidth = True         .RefreshPeriod = 0         .WebSelectionType = xlEntirePage         .WebFormatting = xlWebFormattingNone         .WebPreFormattedTextToColumns = True         .WebConsecutiveDelimitersAsOne = True         .WebSingleBlockTextImport = False         .WebDisableDateRecognition = False         .WebDisableRedirections = False         .Refresh BackgroundQuery:= False     结束//从URL获取数据

Cells.Replace What:="Display System Objects", Replacement:="", LookAt:= _
    xlPart, SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
    ReplaceFormat:=False
Range("C8").Select

0 个答案:

没有答案