Sample code for 30+ languages & platforms
VBScript

Save Web Page to MHT String

See more MHT / HTML Email Examples

Downloads a web page into a string variable containing MHT. MHT is a web archive with all images and style sheets embedded. It's a MIME-formatted text document. When saved with the .mht extension, Internet Explorer can open and display the page.

Chilkat VBScript Downloads

VBScript
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)

' This example assumes the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.

set mht = CreateObject("Chilkat.Mht")

mhtStr = mht.GetMHT("http://www.google.com/")
If (mht.LastMethodSuccess <> 1) Then
    outFile.WriteLine(mht.LastErrorText)

Else
    outFile.WriteLine(mhtStr)
End If


outFile.Close