Chancing / remove “ something ” in the subject, online archive

Status
Not open for further replies.

Ronald1913

New Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Hi :)

I need a macro for chancing / remove “ something ” in the subject, for all mails in the online archive ( office365 ).

Thanks
 

Ronald1913

New Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Hi

Does this work for the online archive in office 365?
I only need it for the online archive.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
you need to run it in outlook, on a folder in the online archive. As the macros are written, they work either on the select items or all items in a folder, so you'd need to run it on each folder.

I'm not aware of a way to do it completely online - powershell might be able to do it, but the admin would need to run it AFAIK. (I don't have a powershell script that can do it.)
 

Ronald1913

New Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Hi :)

That is ok, so is it possible to run this macro on the main folder and all subfolders or is it necessary to run it on each folder?
Yes powershell script is a option to.
 

Ronald1913

New Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Hi

I can use this one to edit one email but it can't continue to the next email.

Option Explicit
Public Sub DoSomethingFolder()
Dim objOL As Outlook.Application
Dim objItems As Outlook.Items
Dim objFolder As Outlook.MAPIFolder
Dim obj As Object

Set objOL = Outlook.Application
Set objFolder = objOL.ActiveExplorer.CurrentFolder
Set objItems = objFolder.Items

For Each obj In objItems

With obj

obj.Subject = Replace(obj.Subject, "test", "")
Debug.Print .Subject

End With

Next

Set obj = Nothing
Set objItems = Nothing
Set objFolder = Nothing
Set objOL = Nothing
End Sub
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
that one should move to the next one - this part tells it to use the current folder and the items in that folder:
Set objFolder = objOL.ActiveExplorer.CurrentFolder
Set objItems = objFolder.Items
For Each obj In objItems

is the word (test in this example) in each subject?

oh, one thing i see i forgot - you need to save the obj for the change to stick - and the keyword is case sensitive.


I tweaked the code with the changes in this snippet -

Code:
Dim i As Long

For Each obj In objItems

With obj
i = i + 1
Debug.Print .Subject
obj.Subject = Replace(LCase(obj.Subject), "test", "")
obj.Save


End With

Next
MsgBox i
 

Ronald1913

New Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Hi and Thanks !

Yes it works fine now like this :
Option Explicit
Public Sub test()
Dim objOL As Outlook.Application
Dim objItems As Outlook.Items
Dim objFolder As Outlook.MAPIFolder
Dim obj As Object

Set objOL = Outlook.Application
Set objFolder = objOL.ActiveExplorer.CurrentFolder
Set objItems = objFolder.Items

Dim i As Long

For Each obj In objItems

With obj
i = i + 1
Debug.Print .Subject
obj.Subject = Replace(obj.Subject, "test", "")
obj.Save


End With

Next
MsgBox i


Set obj = Nothing
Set objItems = Nothing
Set objFolder = Nothing
Set objOL = Nothing
End Sub


Only one thing more : is it possible for this macro to continue into subfolders ?
 
Status
Not open for further replies.
Top