VBA outLook

Sub test()
Dim ol As New Outlook.Application
Dim ns As Outlook.NameSpace
Dim newMail As Outlook.MailItem

Set ns = ol.GetNamespace("MAPI")

Set newMail = ol.CreateItem(olMailItem)
Set newMail = ol.CreateItemFromTemplate("C:\Users\Administrator\AppData\Roaming\Microsoft\Templates\TEST.oft")   '在这个文件夹下要有名叫"mailtemplateteset.oft"的模板,否则会出错

With newMail
  .Subject = "My Subject"
  .To = "aaa@bbb.com"
  .CC = "eee@fff.com"
  .Display  '显示这封邮件,不想显示就把这个注释掉

'  .Send '如果要发送的话把这个注释去掉
End With

Set newMail = Nothing

Set ns = Nothing
End Sub

posted on 2013-09-13 23:35  鱼东鱼  阅读(445)  评论(0编辑  收藏  举报

导航