+ Reply to Thread
Results 1 to 2 of 2

Thread: Extract data from notepad to excel

  1. #1
    Registered User
    Join Date
    02-02-2012
    Location
    india
    MS-Off Ver
    Excel 2007
    Posts
    1

    Extract data from notepad to excel

    hi i have a query regarding data extraction..i want to know if there is a way of extracting data from a notepad into an excel sheet in a table format..My data is in the below format;
    Name;xyz
    Dob:11/11/11
    Address:wewr
    Country:usa
    I want it in a table format like:
    Name Dob address country
    xyz 11/11/11 wewr usa

    is this possible..Thanks

  2. #2
    Registered User
    Join Date
    04-19-2010
    Location
    Ohio, USA
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: Extract data from notepad to excel

    There is a way.

    Dim myPath as String
    Dim readLine as String
    Dim fieldIndex as integer
    
    myPath = "C:\myFile.txt"
    fieldIndex = 1
    Open myPath For Output As #1
    
    Do Until EOF(1)
    
         Line Input #1, readLine
         'readLine is a variable that holds an entire line of your data so you can parse it however you need to.
         'I usually index the fields in a case. line 1 is name, 2 is DOB etc.
         Select Case fieldIndex
         Case 1
         'Code to parse name
         Case 2
         'Code to parse Dob
         'At the last case set the fieldIndex back to 0
         End Select
         fieldIndex = fieldIndex + 1
    Loop
    
    Close #1
    There are variations on this as well. Good luck!
    Excel\Access, VBA, C#, C++, SQL, Java

+ 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.2.0