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
以上就是Attaching HTML file as email in VB 6.0的详细内容,更多请关注web前端其它相关文章!