VBA實現Outlook自動發送帶附件帶簽名的工作周報,vba工作周報

來源:互聯網
上載者:User

VBA實現Outlook自動發送帶附件帶簽名的工作周報,vba工作周報

' 閑話少說 直接上代碼:
Sub zhoubao()        Dim outapp As Object    Dim outmail As Object    Dim body As String    Dim fname As String    Set outapp = CreateObject("Outlook.Application")        '不使用模板    'Set outmail = outapp.CreateItem(0)    '使用模板    Set outmail = outapp.CreateItemFromTemplate("C:\Users\Administrator\AppData\Roaming\Microsoft\Templates\2014年周工作總結與安排(周海清).oft")            '附件    fname = "D:\E\workspaces\3_公司\2_上報公司\1_工作周報\2014年周工作總結與安排(周海清).xlsx"    '本文    body = "<H3><B>Hi ,</B></H3>" & _              "Please see attached!<br>" & _              "<br><br><B></B>" & _              GetSignature()                On Error Resume Next    With outmail        .To = "xxx@chenzhimr.com"                 '收件者        .CC = "xx@czcinfo.com"              '抄送人        .BCC = ""                    '密送人        .Subject = "2014年周工作總結與安排(周海清)——" & Now             '標題        .HTMLBody = body   '.body = body        .Attachments.Add fname        .Send   'or use .Display    End With    On Error GoTo 0        MsgBox ("Sent successfully!")            Set outmail = Nothing    Set outapp = Nothing            ErrMsg:        MsgBox (Err.Description)    End SubPublic Function GetSignature()Dim fso As ObjectSet fso = CreateObject("Scripting.FileSystemObject")SigPath = "C:\Users\Administrator\AppData\Roaming\Microsoft\Signatures\標準_CN.htm"Set f_SignatureObj = fso.OpenTextFile(SigPath, 1, False, 0)GetSignature = f_SignatureObj.ReadAllf_SignatureObj.CloseSet fso = NothingEnd Function


OutLook 2010 怎使用VBA實現:當你寫完一封郵件,點擊發送時,判斷有沒有附件

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim myOlApp As New Outlook.Application
Dim myItem As Outlook.MailItem
Dim myAttachments As Outlook.Attachments
Dim cancelsend As Long
Set myItem = myOlApp.CreateItem(olMailItem)
Set myAttachments = myItem.Attachments
If myItem.Attachments.Count = 0 Then
cancelsend = MsgBox(" 是否忘記粘貼附件了 !" & vbNewLine & vbNewLine & " 確定要發送嗎?", _
vbYesNo + vbDefaultButton2 + vbQuestion, "忘記粘貼附件提示")
If cancelsend = vbNo Then Cancel = True
End If
End Sub
 
outlook裡發送郵件時的自動簽名,再回覆寄件者時不會出現

以outlook 2010為例,你可以點擊左上方的“開始”--“建立電子郵件”,然後你會看到上面一排有個“簽名”的按鈕,點擊那個小三角,出現下拉式功能表,選擇最底下一行的“簽名”,彈出新的對話方塊,在右側有個“選擇預設簽名”,除了那個“新郵件”要選擇相應的簽名,不要忘了“回覆/轉寄”也要選擇對應的簽名哦……都看了吧?應該知道怎麼做了吧?呵呵……不複雜的,2007情況也差不多的,有問題再問。
 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.