+ Reply to Thread
Results 1 to 5 of 5

Text file to Excel Conversion Macro

  1. #1
    Registered User
    Join Date
    12-12-2015
    Location
    Karachi, Pakistan
    MS-Off Ver
    2016
    Posts
    46

    Post Text file to Excel Conversion Macro

    Hi,

    I'm trying to Parse a txt file using VBA. I have successfully retrieved 2 columns from text file but having problems extracting other 4 columns.

    I have attached the dummy text file with all the data and Excel file with sheet demonstrating the after upload output I need.

    So, what I want is that the text file has multiple "61:" and "86:" fields in a single transaction which needs to retrieved in different columns as shown in Excel file attached. Also I want to replicate the results of "Sender:" and "26:" Column until it gets another "Sender:" because a transaction has only one "Sender:" and "26:" field but it has multiple "61:" and "86:" fields. So either we have to replicate the results of "Sender:" and "26:" or leave the others empty until we get another "Sender:" and "26:" field data.

    Please assist and also tell me it's possible or not.

    Thanks in advance.
    Attached Files Attached Files
    Last edited by msb15; 03-10-2016 at 06:19 PM.

  2. #2
    Registered User
    Join Date
    12-12-2015
    Location
    Karachi, Pakistan
    MS-Off Ver
    2016
    Posts
    46

    Re: Text file to Excel Conversion Macro

    Anybody?? A little help please?

  3. #3
    Forum Expert p24leclerc's Avatar
    Join Date
    07-05-2010
    Location
    Québec
    MS-Off Ver
    Excel 2021
    Posts
    2,081

    Re: Text file to Excel Conversion Macro

    Here is a modified macro that seems to do exactly what you want.
    I also attached your workbook with the modified macro in it.
    Please Login or Register  to view this content.
    I hope this will help you
    Regards
    Attached Files Attached Files
    Pierre Leclerc
    _______________________________________________________

    If you like the help you got,
    Click on the STAR "Add reputation" icon at the bottom.

  4. #4
    Forum Contributor S O's Avatar
    Join Date
    06-25-2015
    Location
    England
    MS-Off Ver
    Office 2010 + 2013 + 2016
    Posts
    103

    Re: Text file to Excel Conversion Macro

    Just a note: you don't need to set a scripting reference as the comment suggests because the code uses late binding.

  5. #5
    Registered User
    Join Date
    12-12-2015
    Location
    Karachi, Pakistan
    MS-Off Ver
    2016
    Posts
    46

    Re: Text file to Excel Conversion Macro

    Thanks. The script worked like a charm. Cheers.

+ 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. [SOLVED] Text to Excel Conversion using VBA or Macro
    By msb15 in forum Excel Programming / VBA / Macros
    Replies: 28
    Last Post: 01-24-2016, 05:30 PM
  2. conversion of text file(delimited) into Excel file using macro
    By thara.p24 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-17-2014, 08:35 AM
  3. [SOLVED] XML file conversion to Excel file using macro
    By thara.p24 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-17-2014, 06:47 AM
  4. Replies: 1
    Last Post: 02-23-2013, 08:36 AM
  5. Replies: 16
    Last Post: 07-31-2010, 07:32 PM
  6. Conversion of text files without change in the original file
    By vinwin06 in forum Word Programming / VBA / Macros
    Replies: 3
    Last Post: 07-27-2010, 07:45 PM
  7. Conversion to Text file format error
    By Rob in forum Excel General
    Replies: 1
    Last Post: 06-26-2006, 05:35 AM

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