Results 1 to 4 of 4

Thread: Creating an HTML file from a Text File

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2006
    Posts
    72

    Creating an HTML file from a Text File

    hi all !

    can we create an html file from a text file . The Text file has contents that are comma separated.

    Please Advice

    Cheers
    KK

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Creating an HTML file from a Text File

    Try something as simple as
    VB Code:
    1. Name "c:\hack.txt" As "c:\hack.htm"

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 2006
    Posts
    72

    Re: Creating an HTML file from a Text File

    hi !
    thanks...

    my text file has a structure like this
    Code:
    10:00 am,hi there 
    10:01 am,how are you
    incase i use
    Code:
    Name "c:\hack.txt" As "c:\hack.htm"
    , when i open the html file, the text is not properly structure , as in look does not match with the test file
    is there any way , the look of html file can be made same as text file
    i mean row and column wise

  4. #4
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: Creating an HTML file from a Text File

    To do formatting you'll need to add proper HTML tags.
    Add HTML tags around your text like,
    (writing from memory)
    VB Code:
    1. Dim strNewTxtData As String
    2. strNewTxtData = "<HTML>" & _
    3.                         "<TITLE>My Html File</TITLE>" & _
    4.                         "<BODY>" & _
    5.                         "This is a line" & "<br>" & _
    6.                         "this is another line" & _
    7.                          "</BODY>" & _
    8.                          "</HTML>"
    9. Dim F As Integer
    10. F = FreeFile
    11. Open "C:\MyHtmlFile.html" For Output As #F
    12. Print #F, strNewTxtData
    13. Close #F
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


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