Advertisement
giny8i8

Outlook Macro - Remove Garbage Text from Calendar Invite

Oct 23rd, 2019
945
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub RemoveGarbageText()
  2. ' Removes garbage text from outlook meeting invitation titles. Great for fighting automatic email subject tagging utilized by some  companies.
  3. ' 2019-10-23 by giny8i8 (stolen from the internet somewhere, I can't recall where... :(
  4. ' This script replaces the word [EXTERNAL] to nothing
  5. ' Make sure you set the chracter count properly for the text you want to replace in the "Mid()" function. For the word [EXTERNAL] it is:
  6. ' Mid(Item.Subject, 1, 10)
  7.  
  8. Dim myolApp As Outlook.Application
  9. Dim calendar As MAPIFolder
  10. Dim aItem As Object
  11.  
  12. Set myolApp = CreateObject("Outlook.Application")
  13. Set calendar = myolApp.ActiveExplorer.CurrentFolder
  14.  
  15. Dim iItemsUpdated As Integer
  16. Dim strTemp As String
  17.  
  18. iItemsUpdated = 0
  19. For Each Item In calendar.Items
  20.     If Mid(Item.Subject, 1, 10) = "[EXTERNAL]" Then
  21.       strTemp = Replace(Item.Subject, "[EXTERNAL]", "")
  22.       Item.Subject = strTemp
  23.       iItemsUpdated = iItemsUpdated + 1
  24.     End If
  25.     Item.Save
  26. Next Item
  27.  
  28. MsgBox iItemsUpdated & " of " & calendar.Items.Count & " Meetings Updated"
  29.  
  30. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement