+ Reply to Thread
Results 1 to 5 of 5

Opening a Text File (Tab Delimited)

  1. #1
    Forum Contributor
    Join Date
    11-02-2010
    Location
    Philippines
    MS-Off Ver
    Excel 2003
    Posts
    353

    Opening a Text File (Tab Delimited)

    Hi again everyone!
    Sorry for being a pain but I'd like your help once again.
    Are you able to help me with a Macro that Opens a Text File into the same Sheet that I will run the Macro?
    I would also need help deleting the 1st Line on the Text once it has been opened on Excel.
    Starting line of the Data will be Cell A5.
    I have enclosed my sample worksheet. Thank you in advance.

    Andrew
    Attached Files Attached Files
    Last edited by Andrew.Trevayne; 08-14-2012 at 10:12 AM.

  2. #2
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Opening a Text File (Tab Delimited)

    did you try recording the steps as you do them manually?
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  3. #3
    Forum Contributor
    Join Date
    11-02-2010
    Location
    Philippines
    MS-Off Ver
    Excel 2003
    Posts
    353

    Re: Opening a Text File (Tab Delimited)

    Yes sir I have. But I was hoping that everytime I open a Text File, It would prompt me to select which Text File to Open.
    When I recorded, I had to select the file already. Here's what I currently have:

    Please Login or Register  to view this content.


    ---------- Post added at 01:52 AM ---------- Previous post was at 01:49 AM ----------

    And it is also copying the file starting from Cell A1. I was hoping for it to start at A5. ^^

    ---------- Post added at 01:59 AM ---------- Previous post was at 01:52 AM ----------

    ---------- Post added at 02:00 AM ---------- Previous post was at 01:59 AM ----------

    Okay I've managed the Macro to promt me to select the file to open.
    Here is the code:

    Please Login or Register  to view this content.
    Next step is to get it to open and paste the result startin on Cell A5, any ideas?

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Opening a Text File (Tab Delimited)

    you aren't copying anything-you're opening the file as a workbook which is why the data starts in A1. you can either copy and paste from the new workbook to your target worksheet or import the data from the text file. copy and paste is probably easier since you don't want the first line anyway-just
    Please Login or Register  to view this content.
    for instance.

  5. #5
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,525

    Re: Opening a Text File (Tab Delimited)

    Must this be done by a Macro, or are you open to a non-macro approach? Unless there is something missing in your requirements, i would use the import external data command:

    1) Data menu-> import external data -> import external data
    2) navigate to the desired text file. You may have to tell it to show all files or text files, as those may not display by default.
    3) Once the file is selected, Excel will bring up the text import wizard. As you work through the wizard, you can select options like what to use for the delimiter (tab), what row to start at (it sounds like you want to start on row 2), how to format each column or skip any columns.
    4) After completing the text import wizard, the final dialog will have options for where to put the data (A3), and a properties button through which you can access an additional dialog where you can decide whether to have Excel remember the query definition or not, whether to prompt for the filename each time you want to refresh the data, manual or periodic refresh, and so on.

+ 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