+ Reply to Thread
Results 1 to 10 of 10

With Application.FileSearch error

  1. #1
    Forum Contributor
    Join Date
    07-21-2010
    Location
    Alta, Norway
    MS-Off Ver
    Excel 2003
    Posts
    119

    With Application.FileSearch error

    Hi all!

    I have been using the code below for a while now. It imports all txt files (semicolon delimited) from a folder, deletes the header row of all files, and places them underneath eachother in the first empty row in my sheet.

    We have now changed from excel 2003 to excel 2007 at the office. The code below then errors on the With Application.FileSearch. After websearches I realize that the code does not exsist in 2007 version, and that the does also not exist a "replacement" code.

    I have been trying for a a couple of days now to modify the code, without any success.

    I sincerely hope someone can assist me in modifying the code (I am not very good at programming).

    Please Login or Register  to view this content.
    Best regards
    Gnoke
    Last edited by gnoke; 01-13-2011 at 07:49 AM.

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: With Application.FileSearch error

    Not tested but try this:

    Please Login or Register  to view this content.

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: With Application.FileSearch error

    Please Login or Register  to view this content.
    Last edited by snb; 01-13-2011 at 05:50 AM.



  4. #4
    Forum Contributor
    Join Date
    07-21-2010
    Location
    Alta, Norway
    MS-Off Ver
    Excel 2003
    Posts
    119

    Re: With Application.FileSearch error

    (Posting replays/questions to both that helped me)


    Fantastic Domski! It is almost perfect

    One small issue however. I get an error message saying that the folder C:\files\newImport cannot be found. That is strange, because all files except the oldest is imported.
    Any ideas?

    Gnoke
    Last edited by gnoke; 01-13-2011 at 06:24 AM.

  5. #5
    Forum Contributor
    Join Date
    07-21-2010
    Location
    Alta, Norway
    MS-Off Ver
    Excel 2003
    Posts
    119

    Re: With Application.FileSearch error

    (Posting replays/questions to both that helped me)

    Thanks a lot snb
    The code imports all files, but they are not imported semicolon-delimited.
    Is there a simple way to change this, and maybe delete the header row of the txt files as well?

    You guys rock!

    Gnoke
    Last edited by gnoke; 01-13-2011 at 06:23 AM.

  6. #6
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: With Application.FileSearch error

    Hi,

    There was a 2008 thread in this forum which deals with this.
    http://www.excelforum.com/excel-prog...in-2007-a.html

    Rgds
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  7. #7
    Forum Contributor
    Join Date
    07-21-2010
    Location
    Alta, Norway
    MS-Off Ver
    Excel 2003
    Posts
    119

    Re: With Application.FileSearch error

    Thanks for the link.

    I have been using what I`ve learing here and this link combined: https://sites.google.com/a/madrocket...svs-to-1-sheet

    The code however, misses the same as snb`s above. The imported txt files are not imported semicolon delimited and that the header row is not deleted from each txt file.

    Please Login or Register  to view this content.
    Gnoke
    Last edited by gnoke; 01-13-2011 at 06:40 AM.

  8. #8
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: With Application.FileSearch error

    You can use teh method texttocolumns to split column 1 into different columns.
    In your original code the headers were not filtered out either.
    if headers have a specific property you can easily filter with

    Please Login or Register  to view this content.

  9. #9
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: With Application.FileSearch error

    Put a line in the wrong place I think:

    Please Login or Register  to view this content.

    Dom

  10. #10
    Forum Contributor
    Join Date
    07-21-2010
    Location
    Alta, Norway
    MS-Off Ver
    Excel 2003
    Posts
    119

    Re: With Application.FileSearch error

    Brilliant Domski!

    I can`t thank you enough
    You made my workday so much better!

    Gnoke

+ 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