Microsoft Office Tutorials and References
In Depth Information
Sending a Web Page as the Body of an E-mail Message
'Create mail item body by using HTML code that is created¶
objMail.HTMLBody = strHTML¶
'Show mail item as ready to post¶
objMail.Display¶
'Release objects and free memory¶
Set objMail = Nothing¶
End Sub¶
' * * * * *¶
Private Function GetHTMLCode(ByVal strURL As String) _¶
As String¶
'Variable declaration¶
Dim tmpHTML As String¶
Dim strHTML As String¶
Dim strTemp As String¶
Dim i As Integer¶
'Retrieve current temporary system folder path¶
strTemp = Space$(256)¶
Call GetTempPath(Len(strTemp), strTemp)¶
'Remove unwanted chars from the path variable¶
i = InStr(strTemp, Chr$(0))¶
If i Then¶
strTemp = Left$(strTemp, i - 1)¶
End If¶
'Create temporary html file in local computer¶
'(in previously retrieved temporary folder)¶
'Use a unique name by current time¶
tmpHTML = strTemp & "webpageemail" & _¶
Format(Now, "mmddyyhhmm") & ".html"¶
Call SaveTmpFile(strURL, tmpHTML)¶
'Retrieve HTML code from saved file¶
Open tmpHTML For Binary As #1¶
strHTML = Space(LOF(1))¶
Get #1, , strHTML¶
Close #1¶
'Delete temporary HTML file¶
Kill tmpHTML¶
'Return HTML code¶
GetHTMLCode = strHTML¶
End Function¶
' * * * * *¶
Private Function SaveTmpFile(strURL As String, _¶
tmpHTML As String) As Boolean¶
'API function variables declaration¶
Dim lngret As Long¶
Dim lngInet As Long¶
Dim hInet¶
'Open web page and save its HTML code into the¶
'given temporary HTML file¶
If lngInet = 0 Then hInet = InternetOpen("", 1, _¶
vbNullString, vbNullString, 0)¶
Out
Search JabSto ::




Custom Search