How do you make HTML files with VB, Im pretty sure its possible, cuz Ive seen it done.
Thanks in advanced.
Printable View
How do you make HTML files with VB, Im pretty sure its possible, cuz Ive seen it done.
Thanks in advanced.
HTML files are pure text (aka "flat files") and can be created with any programming language including VB. If you mean having VB create HTML files with VB (as opposed to you) having some understanding of the content, then I've misunderstood your question and do not know the answer.
As an example of what I mean, look at the site
http://www.hobbithouseinc.com/personal/woodpics
There are over 1000 HTML files on that site and all but about 8 or 9 of them were created with VB (and many were then modified by me to have some specific content, but all "href", "img src" and so forth, lines in each HTML file were all created by a VB app that I wrote.
he's basically asking how to createa file. Look in planetsourcecode for the code to make one (it's a couple of lines i believe, don't remember it exactly) and then name it *.htm or *.html and just put the contents in it like a normal txt file.
Now that I think of it thats pretty logical...
It would probably look something like this then.
VB Code:
Name "index.txt" As "index.html"
Since there wont be a text file to begin with, so I need it to be made. So how do I create one.
Either use the file handling stuff in VB (Open, Write etc) or cheat using the FileSystemObject (have a look at the CreateTextFile method of the FileSystemObject)
- gaffa
You can write to any file type that you want. Its up to the program interpreting the file to know whether or not its the correct format.
To create a file...
VB Code:
Open "c:\somefile.html" For Output As #1 Print #1, "<html><b>Poop</b></html>" Close #1
Then find "C:\somefile.html" and open it up.
:)