การสร้างกฎเพื่อเพิ่มลายเซ็น


0

ฉันใช้ Microsoft Outlook 2010 ฉันต้องการสร้างกฎสองข้อนี้

  1. วิชาเฉพาะควรไปที่โฟลเดอร์เฉพาะ (ฉันรู้วิธีการทำ)
  2. เมื่อใดก็ตามที่ฉันส่งต่ออีเมลเหล่านั้นเฉพาะในโฟลเดอร์นั้นฉันต้องการเพิ่มลายเซ็นอีเมลไปยังอีเมลเหล่านั้นเมื่อฉันส่งต่อ

ฉันยังหาวิธีทำกฎที่สองไม่ได้ ความช่วยเหลือใด ๆ

ขอบคุณ

คำตอบ:


1

ฉันแนะนำกฎไม่น่าจะเป็นในการแก้ปัญหา

ลองใช้ดู สร้างโฟลเดอร์ชื่อ Signatures รหัสด้านล่างถือว่าอยู่ภายใต้กล่องจดหมายโดยตรง

จากตัวเลือกฟิลด์สร้างฟิลด์กำหนดโดยผู้ใช้ชื่อซิกในโฟลเดอร์ลายเซ็น

เมื่อรายการถูกเพิ่มลงในโฟลเดอร์ลายเซ็นฟิลด์กำหนดโดยผู้ใช้จะถูกตั้งค่าเป็นใช่ สิ่งนี้จะถูกตรวจสอบเมื่อรายการถูกส่งต่อจากโฟลเดอร์ใด ๆ

หมายเหตุคุณต้องเปิดเมลไม่ใช่ส่งต่อโดยตรงจากมุมมอง explorer

ในโมดูล ThisOutlookSession

' http://superuser.com/questions/327614/outlook-macro-to-interrupt-a-reply-all

Private WithEvents insp As Outlook.Inspectors
Private WithEvents MyMailItem As Outlook.MailItem

Private WithEvents olSignatureItems As items

Private Sub insp_NewInspector(ByVal Inspector As Inspector)
If Inspector.currentItem.Size > 0 And Inspector.currentItem.Class = olMail Then

    Debug.Print " A NEW inspector has opened."
    Set MyMailItem = Inspector.currentItem

End If
End Sub

Private Sub MyMailItem_Forward(ByVal Response As Object, cancel As Boolean)
Dim msg As String
Dim Result As Integer

Dim newFwd As MailItem

If MyMailItem Is Nothing Then
    MsgBox "Problem." & vbCr & vbCr & "Try again while" & _
     "-- You are viewing a single message." & vbCr & _
     vbInformation
    Exit Sub

End If

On Error GoTo exitRoutine

If MyMailItem.UserProperties("Sig").Value = "Yes" Then

    Set newFwd = MyMailItem.Forward

    cancel = True

    MyMailItem.Close olDiscard

    newFwd.Body = "This is the signature." & newFwd.Body

    ' or

    ' http://www.rondebruin.nl/mail/folder3/signature.htm

    newFwd.Display

End If

exitRoutine:

End Sub


Private Sub Application_Startup()

Dim objNS As NameSpace
Dim OutApp As Outlook.Application
Dim i As Long

Set OutApp = Outlook.Application
Set objNS = Application.GetNamespace("MAPI")
Set olSignatureItems = objNS.GetDefaultFolder(olFolderInbox).Folders("Signatures").items
' Debug.Print "Adding items to the - Signatures - folder will trigger olSignatureItems_ItemAdd"    

Set objNS = Nothing

End Sub


Private Sub olSignatureItems_ItemAdd(ByVal Item As Object)
' When an item is added to the Signatures folder the User Defined field is set to Yes.

Dim myNameSpace As NameSpace

Set myNameSpace = Application.GetNamespace("MAPI")

Item.UserProperties.Add("Sig", olText).Value = "Yes"
Item.Save

Set myNameSpace = Nothing

End Sub
โดยการใช้ไซต์ของเรา หมายความว่าคุณได้อ่านและทำความเข้าใจนโยบายคุกกี้และนโยบายความเป็นส่วนตัวของเราแล้ว
Licensed under cc by-sa 3.0 with attribution required.