Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

save as html file

Status
Not open for further replies.

XWalrus2

Programmer
May 27, 2002
47
0
0
US
How do I save the contents of a text box to an html file?
 
Well, are the contents actually html code, or do you need to convert the contents to html?

If it's just that you want to write the contents as an html file (it's a text file) then you just write or print it to a file. Here's a place to start... I suggest researching the subjects of: Open, Print #, and write# as well as "freefile".

Open "c:\temp\test.html" for output as #1 ' (use freefile)
Write #1, text1.text
close #1



[fish] No Dolphins were harmed in the posting of this message... Dolphin Friendly Tuna!
 


Hi XWalrus2:

To build on TheTuna's suggestion, to build an actual HTML file, you will need to add the basic HTML tags.

Code:
    Dim intFileNumber as Integer

    intFileNumber = FreeFile
    Open "c:\temp\test.html" for output as #intFileNumber
    Write #intFileNumber, &quot;<HTML>&quot;
    Write #intFileNumber, &quot;<BODY>&quot;
    Write #intFileNumber, text1.text
    Write #intFileNumber, &quot;</BODY>&quot;
    Write #intFileNumber, &quot;</HTML>&quot;
    Close #intFileNumber

This is the minimum HTML coding that one should use in building an HTML file. There is a lot of other tags and a lot of optional parameters in HTML coding.

Cassie
 
As you say, there are a lot of other tags and a lot of parameters... Since there are too many assumptions, I chose not to even go down that path.



[fish] No Dolphins were harmed in the posting of this message... Dolphin Friendly Tuna!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top