On_The_Level
asked on
Is it possible to output labels to html????
I am using VB6 and was wondering if it is possible to output labels (the contents of labels) to html so you can view them in your browser, or if you can output the form or somehow output it to html and how??
Cheers
Cheers
you are just trying to write the lble caption information to an HTML file correct
You could use this:
open "c:\yourfile.html" for output as #1
print#1, "Your name"
print#1, "Your address"
print#1, "Your city/state/zip"
close#1
This will create an HTML file on your c drive.
Then you can click on the HTML file you created when you are done.
If you want the browser to come up after the processing is done, you can use the ShellExecute command to bring up a browser automatically. If you need to know more about this, let me know.
onemorecoke
open "c:\yourfile.html" for output as #1
print#1, "Your name"
print#1, "Your address"
print#1, "Your city/state/zip"
close#1
This will create an HTML file on your c drive.
Then you can click on the HTML file you created when you are done.
If you want the browser to come up after the processing is done, you can use the ShellExecute command to bring up a browser automatically. If you need to know more about this, let me know.
onemorecoke
How do you want your labels to be displayed? As an extension of onemorecoke's answer, you could output your file as such:
Open "x:\mypath\myhtmlfile.htm" For Output as #1
Print #1, "<HTML><HEAD><TITLE>My Labels</TITLE></HEAD><BODY >"
For Each ctl In myForm.Controls
If TypeOf ctl Is Label Then Print #1, "<P>" & ctl.Caption & "</P>"
Next ctl
Print #1, "</BODY></HTML>"
Close #1
HTH
J.
Open "x:\mypath\myhtmlfile.htm"
Print #1, "<HTML><HEAD><TITLE>My Labels</TITLE></HEAD><BODY
For Each ctl In myForm.Controls
If TypeOf ctl Is Label Then Print #1, "<P>" & ctl.Caption & "</P>"
Next ctl
Print #1, "</BODY></HTML>"
Close #1
HTH
J.
You may need to change the following to
If TypeOf ctl Is Label...
to
If TypeOf ctl Is VB.Label...
Rgds.
J.
If TypeOf ctl Is Label...
to
If TypeOf ctl Is VB.Label...
Rgds.
J.
ASKER
Cheers
I am creating an invoice with the data so il looking to have it output in a invoice way i u know what i mean.
I am creating an invoice with the data so il looking to have it output in a invoice way i u know what i mean.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Say i wanted to output a line or add a line to the html file is that possible?
The HTML code for a simple line is '<HR>' so, if using the above code, add a line like:
Print #1, "<HR>"
at the point that you want the line to be...
J.
Print #1, "<HR>"
at the point that you want the line to be...
J.