Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > VBA / Office Integration > Excel > import txt

Thread Tools Display Modes
Old 04-20-2010, 11:52 AM
luksky luksky is offline
Join Date: Apr 2010
Posts: 1
Default import txt

Hey I have a problem and needs your help
How to import specific lines from txt file.
How to create such a code in vba.
-Load a txt file
-Open it
-Reads for example 2 row
-And paste this line to line, for example, 3 in excel
-I will add that data in the txt file are separated by ":"
-And look more or less like
10, 30, 20-12-2010, Reva; 5

Last edited by luksky; 04-20-2010 at 12:24 PM.
Reply With Quote
Old 04-22-2010, 06:28 AM
zebulon72 zebulon72 is offline
Join Date: Feb 2010
Posts: 74

there are lots of threads with similar questions in this forum, so have a look around and revert back with the code you come up with.

here is something to get you started. i suggest you get all of the text file into a spreadsheet and sort it from there. try recording a macro for text to cols, etc.

' get the text file.
  Open "C:\myfolder1\file1.txt" For Input As #1
    i = 1

    Do Until EOF(1)
        Line Input #1, mylinevar
        Cells(i, 1) = mylinevar
        i = i + 1
    Close #1
Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..