1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
| Sub Macro1()
Application.WindowState = xlMaximized
Dim counter As Integer
Dim stopProcess As Boolean
counter = 1
stopProcess = False
While stopProcess = False
stopProcess = ProcessPage(counter)
counter = counter + 1
Wend
Strip_hash
End Sub
Function ProcessPage(ByVal page) As Boolean
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;https://wwwtest.com/api.php?api_key=3ff8145cc60e89642f0394f96b506a6932dfd1db660a9d1b345c1c1e9db95038d7320132&api_action=account_list&api_output=xml&page=" & page _
, Destination:=Range("$A$" & ((page - 1) * 22) + 1))
.Name = _
"api.php?api_key=3ff8145cc60e89642f0394f96b506a6932dfd1db660a9d1b345c1c1e9db95038d7320132&api_action=account_list&api_output=xml&page=1"
.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
End With
Range("$A$" & ((page - 1) * 22) + 1 + 21).Select
If Len(ActiveCell.FormulaR1C1) = 0 Then
ProcessPage = True
Else
ProcessPage = False
End If
End Function
Sub Strip_hash()
Dim Cel As Range
Application.ScreenUpdating = False
Do
Set Cel = Cells.Find(what:="#agg", LookIn:=xlValues, lookat:=xlPart)
If Cel Is Nothing Then Exit Do
Cel.Resize(21, 1).Delete shift:=xlShiftToLeft
Loop
End Sub |
Partager