I have a macro called from one workbook, that is supposed to:
1. open Workbook "AllCompetitions"
2. go through the list of links in AllCompetitions file
3. use link to perform WebQuery
4. extract some data
5. perform WebQuery on link in the next row and so on....
Code:
Sub Nadji_sva_gotova_natjecanja()
Dim Wbk_radna As Workbook
Dim zadnjired As Integer
Dim hlink As Hyperlink
Application.ScreenUpdating = True
Set Wbk_radna = Workbooks.Open("AllCompetitions")
Wbk_radna.Worksheets(1).Activate
Wbk_radna.EnableConnections
zadnjired = Cells.Find("*", SearchOrder:=xlByRows, LookIn:=xlValues, SearchDirection:=xlPrevious).EntireRow.Row
For i = 1 To zadnjired
Call Perform_Web_Query(Wbk_radna.Worksheets(1).Cells(i, 1).Value & "fixtures/", Wbk_radna)
Wbk_radna.Worksheets(1).Cells(i, 7).Value = "processed"
For Each hlink In Wbk_radna.Worksheets(2).Hyperlinks
If InStr(1, hlink.Address, "nextmatch.php") > 0 Then
Wbk_radna.Worksheets(1).Cells(i, 6).Value = "ongoing"
Exit For
End If
Next hlink
Wbk_radna.Worksheets(2).UsedRange.Clear
Next i
End Sub
Perform_Web_Query procedure does nothng special but retrieving web data:
Code:
Sub Perform_Web_Query(trazeni_string As String, radna As Workbook, Optional s_popisom As Workbook)
Dim hlink As Hyperlink
radna.Worksheets(2).Activate
radna.EnableConnections
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;" & trazeni_string, Destination:=Range("$A$1"))
.Name = "sweden"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = False
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingAll
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = True
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub
I was sure there's was nothing wrong with the code so I saved the files as Excel 2003 and everything was fine and worked fine!
So, WHAT CHARMINGLY IRRITATING FEATURE they managed to put in, what retarded security level that keeps bumping my head into the wall with message:
Quote:
Run time error 1004
The file could not be accessed. Try one of the following
|