|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Create a html file from Visual basic
I am working in Access 2000 and was wondering if anyone knows how to create a HTML file in Visual Basic?
The goal is to pass a variable to the HTML File in VB and then create/save the html file, attach that file and send an email message. Any Help would be appreciated. |
|
#2
|
||||
|
||||
|
well, if you can use an Outlook object, then there is a method of the application object that is called "HTMLBody" where you can pass in an HTML string that will build a HTML page "on-the-fly"...
I have also built other applications using the CDO object and the SMTP ActiveX control and simply passed in an HTML string as the body. It will work (sometimes) if the client has an HTML enabled mail client. If you have access (no pun intended), then I would use the Outlook object of MSOffice. It's very simple to use.
__________________
Fisherman "Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." - A.Einstein |
|
#3
|
|||
|
|||
|
You can use Access built-in export to html to create an html file on disk, and then use CDO or some other email component to create an email message & attach the previously exported file.
|
|
#4
|
|||
|
|||
|
Create an actual HTML FILe
Well all I want to do is to create an HTML File form Visual Basic, actually create the file and attach it to an email. I am doing this because I want to send multiple invoice type html documents to a person in our organization so that they can look at them easily.
|
|
#5
|
||||
|
||||
|
I see... can you simply open a freeform file, build an HTML string, print it to the file, and then close it? I did this in the form load event of a new VBapp
Code:
Private Sub Form_Load() Dim strHTML As String strHTML = "<HTML><HEAD><TITLE>This is the Title</TITLE></HEAD><BODY>This is the body</BODY></HTML>" Open "C:\Documents and Settings\All Users\Desktop\Sample.html" For Append As #1 Print #1, strHTML Close #1 End Sub Last edited by Fisherman : November 11th, 2003 at 12:32 PM. |
|
#6
|
||||
|
||||
|
im probably wrong here but, i think you would have to open the file for output not append wouldnt you, because otherwise it would just add your new data to the bottom of the file, and therefore it being html would show the old data (page) all the time, instead of the new data. If you open a file for output it overwrites the data in the file, so would in theory work better....as i said, i may be wrong, but thats my 2 cents
![]() |
|
#7
|
||||
|
||||
|
You are correct, for the most part, anyway. If it you are authoring the file and not changing it, then all you have to do is do an append... append will write to the file whether anything is in it or not, if there is, then it will write at the end of the existing file. I'm not concerned with this since I would ordinarily just delete and rebuild the file anyway if I needed to change it, instead of using processing time to look for a particular line of text that I wanted to change.
|
|
#8
|
|||
|
|||
|
Yes!FisherMan!It's a easy way that Read the old file's content,Delete the old file,And write the old file's content and new content to a new file!
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > Create a html file from Visual basic |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|