+ Reply to Thread
Results 1 to 2 of 2

Generalizing a recorded macro to import daily text file

  1. #1
    Registered User
    Join Date
    05-15-2012
    Location
    Salem, Oregon
    MS-Off Ver
    Excel 2007
    Posts
    7

    Generalizing a recorded macro to import daily text file

    I recorded a macro to pull text file data into a template. I wanted to make it apply to any file I was pulling in, so I replaced the date information in the file name referenced in the code with the wildcard * so that (I assumed) it would just pull in the first file it found in the folder. When I run it, the template file is pulled up - but I get the message:

    Run-time error '1004':
    The 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 file name does not contain any of the following characters: < > ? [ ] : | or *
    •Make sure the file/path name doesn't contain more than 218

    When I go to the Debug, the .Refresh BackgroundQuery:=False line below is what is highlighted as the problem, but I'm not savvy enough to troubleshoot this on my own.

    Please Login or Register  to view this content.
    When I ran the macro as recorded, it reproduced the correct results (see attached). Ultimately I need to run this for a large number of files, but don't need it to loop (yet).

    Thanks for any help provided!
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    05-15-2012
    Location
    Salem, Oregon
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Generalizing a recorded macro to import daily text file

    Bump no response

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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