我正在尝试将html文件文件附加到使用Visual Basic 6.0的电子邮件。当光标出现时打开strFile对于二进制访问读为#hFile行给出错误“错误编码文件 - 错误的文件名或编号”。请高度赞赏您的所有帮助和支持。在VB 6.0中将HTML文件附加为电子邮件
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
+1因为你是对的,但我不认为这是造成沙克斯所问的错误 – MarkJ 2010-04-14 20:55:40