+ Reply to Thread
Results 1 to 4 of 4

Run-time error '1004' for .Refresh BackgroundQuery:=False for loop

  1. #1
    Registered User
    Join Date
    10-18-2013
    Location
    Troy, MI
    MS-Off Ver
    Excel 2007
    Posts
    12

    Run-time error '1004' for .Refresh BackgroundQuery:=False for loop

    Good Afternoon All,

    I recently received help on a macro I am creating to run a loop through all files in a set folder. (seen here:
    http://www.excelforum.com/excel-prog...ml#post3471431)
    A very helpful member has assisted me in my journey of completing said task but I am faced with an error of "Run-time error '1004': Excel cannot find the text file to refresh this external data range" and then proceeds to end up at the line:
    .Refresh BackgroundQuery:=False

    Its not producing an output file for the first one before looping through and I cannot figure out how to resolve the error.
    Any suggestions or reference material would be greatly appreciated!



    Please Login or Register  to view this content.

  2. #2
    Forum Contributor noboffinme's Avatar
    Join Date
    08-29-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003/7/10/13/16/19
    Posts
    1,071

    Re: Run-time error '1004' for .Refresh BackgroundQuery:=False for loop

    Hi Robo25,

    Just having a quick look at your code.

    I can't see where you have described the 'Path' before you used it in the code.

    This will give you a '1004' error.
    Remember you are unique, like everyone else

  3. #3
    Registered User
    Join Date
    10-18-2013
    Location
    Troy, MI
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Run-time error '1004' for .Refresh BackgroundQuery:=False for loop

    Thanks for the reply noboffineme. I think in line 3 of the code is where I have a path set.
    Input_File = Dir("C:\Path\*.pch")

  4. #4
    Forum Contributor noboffinme's Avatar
    Join Date
    08-29-2013
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2003/7/10/13/16/19
    Posts
    1,071

    Re: Run-time error '1004' for .Refresh BackgroundQuery:=False for loop

    What I mean is there is no definition of the Path to the file & therefore can't locate the file to refresh the range...

    Unless you have a folder called 'Path' on your 'C' Drive, is that the case?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Run-Time error '1004' .refresh background query:= False
    By batador in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-24-2013, 06:00 AM
  2. Replies: 1
    Last Post: 12-03-2011, 10:32 AM
  3. Error in Macro: (Refresh BackgroundQuery:=False)
    By abehnamian in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-26-2008, 12:45 PM
  4. Syntax error 1004 at ".Refresh BackgroundQuery:=False"
    By roth_georg in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-30-2008, 07:58 AM
  5. Error with Selection.QueryTable.refresh BackgroundQuery:=False
    By rivets in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-20-2007, 01:40 PM

Tags for this Thread

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