VBA 中,該如何將文字內容寫入文字檔案?

VBA 中,該如何將文字內容寫入文字檔案?
以範例說明會比較實用:

Dim FileNumber As Integer
Dim strFile As String

FileNumber = FreeFile()
Open strPath & "\" & strFileName For Output As #FileNumber

Print #FileNumber, "<html>"
Print #FileNumber, "<head>"
Print #FileNumber, "   <meta http-equiv=""Content-Language"" content=""zh-tw"">"
Print #FileNumber, "   <meta http-equiv=""Content-Type"" content=""text/html; charset=big5"">"
Print #FileNumber, "   <title>" + frm上傳檔案資料.Form.file_namec + "</title>"
Print #FileNumber, "</head>"
Print #FileNumber, ""
Print #FileNumber, "<body>"
Print #FileNumber, "</body>"
Print #FileNumber, "</html>"

Close #FileNumber

沒有留言: