Results 1 to 3 of 3

Thread: [RESOLVED] Creating Text Files From Excel's VBA

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2006
    Posts
    48

    Resolved [RESOLVED] Creating Text Files From Excel's VBA

    So, (with some help, thx Si) I've successfully used the code below to create Text files from Excel's VBA. I have a new problem though.

    How do I pass more than one line of text to the file?
    Ideally I'ld like to be able to pass an ENTER keystroke(within "myString") and continue sText (myString) on a new line.


    VB Code:
    1. Dim sFile As String
    2. Dim sText As String
    3. Dim iFileNum As Integer
    4.  
    5. sFile = "C:\(path)\Textfile.txt"
    6.  
    7. sText = "myString"
    8.  
    9. iFileNum = FreeFile
    10. Open sFile For Output As iFileNum
    11. Print #iFileNum, sText
    12. Close #iFileNum
    Last edited by RobDog888; Jun 7th, 2006 at 05:33 PM. Reason: Fixed vbcode tags

Posting Permissions

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



Click Here to Expand Forum to Full Width