標題:
[發問]
如何以巨集執行mail上傳
[打印本頁]
作者:
lone_tiger0303
時間:
2010-7-24 09:02
標題:
如何以巨集執行mail上傳
我想要作一個CommandButton1可以一按就將檔案mail上傳指定帳號
請問巨集程式要如何寫呢
作者:
jackdream
時間:
2010-7-24 15:17
回復
1#
lone_tiger0303
'以 MS OutLook 寄信(非 OutLook Express)
'若出現 使用者自訂型態尚未定義, 則依以下設定
'工具 --> 設定引用項目 -->MicroSoft Outlook 11.0 object library
'若是Office 2003 是11.0,若是 Office 2002 則是10.0 以下類推
Sub send_mail()
Dim oltAPP As Outlook.Application
Dim myMail As MailItem
Set oltAPP = CreateObject("Outlook.Application")
Set myMail = oltAPP.CreateItem(olMailItem)
With myMail
.Attachments.Add "d:\t1.txt" '附件(請自行更改路徑)
.To = "
[email protected]
" '收件者信箱
.BodyFormat = olFormatRichText
.Body = "這是一封測試信件" '信件內容
.Subject = "測試信件" '信件主旨
.Send
End With
oltAPP.Quit
Set oltAPP = Nothing
Set myMail = Nothing
End Sub
複製代碼
歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)