Attaching HTML file as email in VB 6.0
Posted
by Shax
on Stack Overflow
See other posts from Stack Overflow
or by Shax
Published on 2010-01-20T12:14:12Z
Indexed on
2010/04/08
18:23 UTC
Read the original article
Hit count: 312
Hi, I am trying to attach an html file file to email using Visual Basic 6.0. when the cursor is comes on Open strFile For Binary Access Read As #hFile line it gives error "Error encoding file - Bad file name or number". Please all your help and support would be highly appreciated.
Dim handleFile As Integer
Dim strValue As String
Dim lEventCtr As Long
handleFile = FreeFile
Open strFile For Binary Access Read As #handleFile
Do While Not EOF(hFile)
' read & Base 64 encode a line of characters
strValue = Input(57, #handleFile)
SendCommand EncodeBase64String(strValue) & vbCrLf
' DoEvents (occasionally)
lEventCtr = lEventCtr + 1
If lEventCtr Mod 50 = 0 Then DoEvents
Loop
Close #handleFile
Exit Sub
File_Error:
Close #handleFile
m_ErrorDesc = "Error encoding file - " & Err.Description
Err.Raise Err.Number, Err.Source, m_ErrorDesc
End Sub
© Stack Overflow or respective owner