+ Reply to Thread
Results 1 to 2 of 2

Runtime Error 1004 : file could not be accessed

Hybrid View

  1. #1
    Registered User
    Join Date
    07-22-2009
    Location
    toronto
    MS-Off Ver
    Excel 2003
    Posts
    5

    Runtime Error 1004 : file could not be accessed

    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
    Last edited by deepyogi; 07-23-2009 at 03:20 PM.

  2. #2
    Registered User
    Join Date
    07-22-2009
    Location
    toronto
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Runtime Error 1004 : file could not be accessed

    anyone????

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1