Results 1 to 1 of 1

TXT Files + Cell Content => TXT File (1 new file for each cell)

Threaded View

nini86 TXT Files + Cell Content =>... 11-15-2013, 01:07 PM
  1. #1
    Registered User
    Join Date
    11-15-2013
    Location
    Bremen, Germany
    MS-Off Ver
    Excel 2013
    Posts
    1

    TXT Files + Cell Content => TXT File (1 new file for each cell)

    Hi,
    I am stuck. I want to combine a txt file with the content of a cell and another txt file to form a new txt file. (SourceFile1.txt + cell content + SourceFile2.txt = OutputFile.txt).

    I have a table with column with several values. I would like to have one File for each Cell in that collumn.


    yvbjOrU.jpg

    For example:
    Outputfile 1:

    Sourcefile 1
    A1
    Sourcefile 2
    Outputfile 2:
    Sourcefile 1
    A2
    Sourcefile 2
    Outputfile 3:
    Sourcefile 1
    A3
    Sourcefile 2


    My sourcecode so far (doesn't work):
    Sub SaveFile() 
    
    Source1 = FreeFile() 
    Open "D:\Source1.txt" For Input As Source1 
    
    Source2 = FreeFile() 
    Open "D:\Source2.txt" For Input As Source2 
    
    
    Do While Not IsEmpty(ActiveCell.Offset(0, 1)) 
        MyFile = ActiveCell.Value & ".txt" 
        output = FreeFile() 
        Open MyFile For Output As output 
            Do While Not EOF(Source1) 
                Line Input #Source1, Temp 
                Print #output, Temp 
            Loop 
        Print #output, ActiveCell.Offset(0, 1) & " " & ActiveCell.Offset(0, 2) 
            Do While Not EOF(Source2) 
                Line Input #Source2, Temp 
                Print #output, Temp 
            Loop 
    Close #output 
    ActiveCell.Offset(1, 0).Select 
    Loop 
    
    Close #Source1 
    Close #Source2 
    
    End Sub


    I hope someone can point me in the right direction or give a working source code!
    Thank you :-)


    [Edit]
    Image for clarification:
    gfx.jpg
    Last edited by nini86; 11-15-2013 at 01:51 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Save cell content as .scr file
    By sakinen in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-05-2013, 02:31 AM
  2. Replies: 1
    Last Post: 08-16-2013, 04:23 AM
  3. Import multiple jpg files in one file with file name in next cell
    By samyell in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-15-2013, 07:58 AM
  4. link cell content to another file
    By blackstar in forum Excel General
    Replies: 2
    Last Post: 04-03-2006, 10:25 PM
  5. Assign Cell Content As File Name
    By paul.sternhagen@gmail.com in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-18-2005, 02:05 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