- 帖子
- 133
- 主題
- 9
- 精華
- 0
- 積分
- 147
- 點名
- 0
- 作業系統
- Win10
- 軟體版本
- Office 2010
- 閱讀權限
- 20
- 性別
- 男
- 來自
- 高雄
- 註冊時間
- 2010-5-1
- 最後登錄
- 2024-11-11
|
2#
發表於 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 = "test123@ttt.com.tw" '收件者信箱
- .BodyFormat = olFormatRichText
- .Body = "這是一封測試信件" '信件內容
- .Subject = "測試信件" '信件主旨
- .Send
- End With
- oltAPP.Quit
- Set oltAPP = Nothing
- Set myMail = Nothing
- End Sub
複製代碼 |
|