+ Reply to Thread
Results 1 to 10 of 10

open txt files Delimited, Space

  1. #1
    Registered User
    Join Date
    09-06-2008
    Location
    San Diego
    Posts
    4

    open txt files Delimited, Space

    Good day.

    On a daily basis I open about 35 text files in Excel at one time, and then must responde to 35 dialog boxes:

    "This file is not in a recognizable format" - I click OK
    "Delimited or Fixed Width (default)" - I change to Delimited
    "Delimiters listed with Tab as default" - I change to Space

    I go through that 35 times. I don't save these files that I have opened, but once they are all open I paste each one in a separate worksheet in one workbook.

    Can I at least change the defaults on these text boxes to Delimited, Space? That way I would just need to click on OK, then Finish for each file.

    Any other ideas? I am using Excel 2000.

    Thanks so much,
    Terry
    Last edited by terrysd; 09-06-2008 at 02:09 PM.

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967
    Sounds like a good candiate for automation. Can you post an example of one of the text files so that we can see what the format actually is?
    Martin

  3. #3
    Registered User
    Join Date
    09-06-2008
    Location
    San Diego
    Posts
    4

    example of txt file

    Hi Martin,

    I have attached the original data file that I use. I added the .txt extension just to upload it here successfully.

    I mentioned that I paste each of these files into separate tabs in one workbook. That workbook has a summary tab that links fo the specific cells of each tab. When I open these as Space deliminted the data in these reports are in the same fixed location each day, allowing for this linking.

    I will be off-line for a few hours.

    Good day,
    Terry
    Attached Files Attached Files
    Last edited by terrysd; 09-06-2008 at 03:13 PM.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Maybe like this:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    09-06-2008
    Location
    San Diego
    Posts
    4
    Hello shg

    I created that macro and got this message when trying to run it:

    Run-time error '438':
    Object doesn't support this property or method


    The debugger stopped at this line:
    With Application.FileDialog(msoFileDialogFolderPicker)

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Excel version?

  7. #7
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967
    The data in your .txt file has a complex format which is probably why Excel can't recommend the best course of action. In principle, you might require a more sophisticated macro which reads in the lines one at a time and uses a set of rules based upon the text in order to split the text into cells. Provided the rules were specified completely enough, this approach would even cope with files which differed in their numbers of lines in each of the sections.

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    I had no difficulty opening your test file with the code.

    You might try replacing
    Please Login or Register  to view this content.
    with
    Please Login or Register  to view this content.
    for now.

  9. #9
    Registered User
    Join Date
    09-06-2008
    Location
    San Diego
    Posts
    4

    It Worked!

    Thanks shg! Replacing the code as you suggested worked perfectly! The associates who do this daily procedure were thrilled to see this Macro.


    Thanks for your reply mrice. I didn't know that Excel would recommend the course of action based on the layout of the data. I assumed that the Fixed Width, Data Delimited defaults were standard.

    good day!

  10. #10
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    Good, glad it worked for you. Thanks for the feedback.

+ 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. Excel files won't open:blank excel interface
    By moding blaine in forum Excel General
    Replies: 5
    Last Post: 07-29-2008, 05:02 PM
  2. Excel tries to open other files when first opening
    By Lea724 in forum Excel General
    Replies: 4
    Last Post: 07-10-2008, 05:43 PM
  3. Macro - Collect data - Select folder and loop through all xls files
    By kostas in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-04-2008, 05:58 AM
  4. Open Files
    By walid66 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-26-2007, 03:01 AM
  5. Open Files Separately
    By smckie in forum Excel General
    Replies: 4
    Last Post: 03-14-2007, 03:05 PM

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