我正在嘗試將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