Consulting

Results 1 to 3 of 3

Thread: Solved: Create a .txt file

  1. #1

    Solved: Create a .txt file

    Hi!

    Is it possible to make a workbook create a .txt file containing the value of a certain cell?

    I would like to make this happen and for the .txt file to be placed in the same folder as the workbook.

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    [VBA]Sub Test()
    Dim ff As Integer, sDir1 As String, sFN1 As String

    Range("A1").Value = "Hello World!"

    sDir1 = ThisWorkbook.Path & "\"
    sFN1 = "Test.txt"

    ff = FreeFile
    Open sDir1 & sFN1 For Output As #ff
    Print #ff, Range("A1").Value
    Close #ff

    Shell "Notepad.exe " & sDir1 & sFN1
    End Sub[/VBA]

  3. #3
    This was exaxtly how I meant.

    Thank you Kenneth!

    Rejje

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •