我是 Excel VBA/宏的新手
我需要抓取页面的特定部分,而不是整页。波纹管代码在完整页面中工作,但不需要页面的所有部分。
Sub GrabOutStandingTable()
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://dsebd.org/displayCompany.php?name=ABBANK", Destination:=Range( _
"$A$1"))
.CommandType = 0
.Name = "displayCompany.php?name=ABBANK"
.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 = """company"""
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
Sheets.Add After:=ActiveSheet
End Sub
标题为“公司其他信息”的表格部分在页面的下部,这就是我所说的。宏应该提取这部分。