Sample code for 30+ languages & platforms
Visual Basic 6.0

Extract Files from MIME

See more MIME Examples

Extract files from a MIME message.

Chilkat Visual Basic 6.0 Downloads

Visual Basic 6.0
Dim success As Long
success = 0

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

Dim mime As New ChilkatMime

' Load a MIME document from a file:
' (.mht and .eml files contain MIME).
success = mime.LoadMimeFile("mst.mht")
If (success = 0) Then
    Debug.Print mime.LastErrorText
    Exit Sub
End If

Dim st As New ChilkatStringTable
success = mime.PartsToFiles("/temp/mimeParts",st)
If (success = 0) Then
    Debug.Print mime.LastErrorText
    Exit Sub
End If

Dim n As Long
n = st.Count

' Display the paths of the files created:
Dim i As Long
i = 0
Do While i < n
    Debug.Print st.StringAt(i)
    i = i + 1
Loop