Hi
I don't know what went wrong but this same piece of macro code was running yesterday and today it is giving me this error. can a pro take a look. please..
Sub pinfo()
Dim pages As Integer
Dim x As Integer
x = 1
For pages = 1 To 30
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;http://www.nhl.com/ice/app?service=page&page=playerstats&fetchKey=20092ALLSASAll&viewName=bios&sort=player.birthCountryAbbrev&pg=" & pages _
, Destination:=Range("$A$1"))
.Name = _
"app?service=page&page=playerstats&fetchKey=20092ALLSASAll&viewName=bios&sort=player.birthCountryAbbrev&pg=" & pages
.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
Rows("107:136").Select
Selection.Copy
Sheets("Sheet5").Select
Do Until Cells(x, 1) = vbNullString
x = x + 1
Loop
Cells(x, 1).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Sheets("Sheet1").Select
Cells.Select
Selection.QueryTable.Delete
Selection.ClearContents
Range("A1").Select
Next pages
End Sub
the error i get is
Runtime Error '1004'
File could not be accessed. try one of the following
- make sure the specified folder exists
- make sure the folder that contains the file is not read-only
- make sure the filename does not contain any of the characters < > ? [ ] |
- make sure file/path name does not contain more than 128
any insights into how to solve this will be greatly appreciated
Bookmarks