+ Reply to Thread
Results 1 to 4 of 4

looping, Open text file, copy text, close text file

  1. #1
    Registered User
    Join Date
    06-08-2009
    Location
    Detroit, MI
    MS-Off Ver
    Excel 2003
    Posts
    9

    looping, Open text file, copy text, close text file

    Need some assistance. I have an existing spreadsheet with a column of strings (actually VIN numbers). These numbers correllate to a bunch of text files, that can exist in one of three folders (\Username\Desktop\1, 2, or 3) on my desktop. What I need the macro to do is:

    1) get the filename from A2 (A1 is a heading row)
    2) Find the appropriate text file in one of the three folders
    3) Put the folder name into I2
    4) Scan the text file for some strings, and copy some data that follows those strings into J2:O2 (I can handle programming this)
    5) Close the text file
    6) repeat above for the remainder of filenames (about 1800 files)

    Any assistance you can offer would be great
    Last edited by jwilds1; 09-18-2009 at 11:06 AM.

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,324

    Re: looping, Open text file, copy text, close text file

    hi jwilds1
    this is untested but try this in a test workbook
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    06-08-2009
    Location
    Detroit, MI
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: looping, Open text file, copy text, close text file

    Through a little trial and error I got the following to work:

    Please Login or Register  to view this content.
    It's unelegant (is that a word?), but it works. Thanks!!!

  4. #4
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,324

    Re: looping, Open text file, copy text, close text file

    jwilds1
    do you have a sample work book that you can post
    It just makes it easier to work with and we can streamline the code and make it eligant

+ 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