Note: The other languages of the website are Google-translated. Back to English

Sut i gael gwared ar yr atodiadau yn awtomatig ar ôl e-byst yn anfon o'r eitemau a anfonwyd?

Wrth anfon e-bost gyda rhai atodiadau, bydd yr atodiadau yn cael eu storio gyda'r e-byst i'r ffolder eitemau a anfonir yn ddiofyn. Er mwyn lleihau maint eich ffeil PST, efallai yr hoffech chi dynnu'r atodiadau o'r eitemau a anfonwyd yn awtomatig ar ôl anfon e-byst. Yr erthygl hon, byddaf yn siarad am y dasg hon yn Outlook.

Tynnwch yr atodiadau yn awtomatig ar ôl anfon e-byst o'r eitemau a anfonwyd


Tynnwch yr atodiadau yn awtomatig ar ôl anfon e-byst o'r eitemau a anfonwyd

Gall y cod VBA canlynol eich helpu chi i ddileu'r atodiadau yn awtomatig ar ôl e-byst sy'n anfon o'ch Outlook, gwnewch fel hyn:

1. Daliwch i lawr y ALT + F11 allweddi i agor y Microsoft Visual Basic ar gyfer Ceisiadau ffenestr.

2. Yn y Microsoft Visual Basic ar gyfer Ceisiadau ffenestr, cliciwch ddwywaith SesiwnOutlook oddi wrth y Prosiect1 (VbaProject.OTM) cwarel i agor y modd, ac yna copïo a gludo'r cod canlynol i'r modiwl gwag.

Cod VBA: Tynnwch atodiadau yn awtomatig ar ôl anfon e-byst o'r eitemau a anfonwyd:

Public WithEvents SentMailItems As Outlook.Items
    Private Sub Application_Startup()
    Set SentMailItems = Outlook.Application.Session.GetDefaultFolder(olFolderSentMail).Items
    End Sub
    Sub SentMailItems_ItemAdd(ByVal Item As Object)
    Dim xSentMail As Outlook.MailItem
    Dim xAttachments As Outlook.Attachments
    Dim xAttachment As Outlook.Attachment
    Dim xAttachmentInfo As String
    On Error Resume Next
    If Item.Class = olMail Then
       Set xSentMail = Item
    End If
    Set xAttachments = xSentMail.Attachments
    For i = xAttachments.Count To 1 Step -1
        Set xAttachment = xAttachments.Item(i)
        xAttachmentInfo = "<HTML><BODY>" & xAttachment.DisplayName & _
                          "</BODY></HTML>" & vbCrLf & xAttachmentInfo
        xAttachment.Delete
    Next
    xSentMail.HTMLBody = "<HTML><BODY><font color=#FF0000>Attachment Removed: </font><br/></BODY></HTML>" & _
                         xAttachmentInfo & "<HTML><BODY><br/></BODY></HTML>" & xSentMail.HTMLBody
    xSentMail.Save
End Sub

3. After inserting the above code, please restart your Outlook to make the code take effect.

4. From now on, when you send emails with attachments, the attachments will be deleted automatically from the sent items as following screenshot shown:

Note: This code is only available to the default data account.


Kutools for Outlook - Brings 100 Advanced Features to Outlook, and Make Work Much Easier!

  • Auto CC/BCC by rules when sending email; Auto Forward Multiple Emails by custom; Auto Reply without exchange server, and more automatic features...
  • BCC Warning - show message when you try to reply all if your mail address is in the BCC list; Remind When Missing Attachments, and more remind features...
  • Reply (All) With All Attachments in the mail conversation; Reply Many Emails in seconds; Auto Add Greeting when reply; Add Date into subject...
  • Attachment Tools: Manage All Attachments in All Mails, Auto Detach, Compress All, Rename All, Save All... Quick Report, Count Selected Mails...
  • Powerful Junk Emails by custom; Remove Duplicate Mails and Contacts... Enable you to do smarter, faster and better in Outlook.
shot kutools outlook kutools tab 1180x121
shot kutools outlook kutools plus tab 1180x121
 
Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Leave your comments
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations