+ Reply to Thread
Results 1 to 3 of 3

Create text file using VBA from Excel Tabular data

Hybrid View

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

    Create text file using VBA from Excel Tabular data

    Greetings to All,

    Hope all are great and fine.

    I have a request regard to create text file using vba macro from using Excel sheet data's.

    I request you all and help me on this to move forward.

    Here is an Example:

    EXCEL.png

    FileName - Need to create text file in this name.
    Line 1 to 6 - need to write line by line in each text file.

    Kindly review my consideration and do the needful.

    Thanks

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Create text file using VBA from Excel Tabular data

    Change the destination save path to suit.

    Sub Make_Text_Files()
        Dim i As Long, j As Long, v As Variant, strPath As String, FF As Long
        v = Range("A1").CurrentRegion.Value
        strPath = "C:\Test\"
        FF = FreeFile()
        For i = 2 To UBound(v, 1)
            Open strPath & v(i, 1) For Output As #FF
            For j = 2 To UBound(v, 2)
                Print #FF, v(i, j)
            Next j
            Close #FF
        Next i
        MsgBox UBound(v, 1) - 1 & " files created.", vbInformation, "Write Files Complete"
    End Sub
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    02-07-2012
    Location
    Chennai
    MS-Off Ver
    Excel 2007
    Posts
    54

    Re: Create text file using VBA from Excel Tabular data

    Great !!!

    It works perfect.

+ 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] Create a Dynamic Range within a Formula for External Tabular Data
    By kujoking7 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-08-2018, 04:42 PM
  2. Copy the tabular data from mail body to an excel file(.xlsm) using vba
    By raushanaj5 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-07-2017, 01:57 AM
  3. Replies: 0
    Last Post: 04-07-2017, 01:57 AM
  4. Replies: 0
    Last Post: 06-11-2014, 03:10 AM
  5. Import multiple text file into excel in tabular format
    By kr.sunny007 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-04-2013, 09:32 AM
  6. Create Multiple Text file from excel data regarding conditions
    By ahasan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-23-2013, 07:10 AM
  7. Flat File to Tabular Data Set Conversion
    By november678x in forum Excel General
    Replies: 2
    Last Post: 05-14-2010, 01:47 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