Convert Subject Line to Internet Header version of Subject

Outlook version
Outlook 2013 64 bit
Email Account
Exchange Server
Hi.
I attempted a VBA a few weeks ago and messed it up. I changed 500+ emails so that the subject for each one reads "New Subject". How can I correct this using the Internet Header "Subject" that is within the email? I can see it one at a time for copy/paste but, I'd like to do it more efficiently.

Thank you.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Outlook version
Outlook 2013 64 bit
Email Account
Exchange Server
That worked so well!
It appears that the subject line is listed (in the hidden details) across two lines with a hard return in the middle. Any ideas on how to fix that?
 
Outlook version
Outlook 2013 64 bit
Email Account
Exchange Server
Hi Diane...
To clarify, let me show you the pieces of what I'm trying to resolve on this last part.

The Internet Headers lists the Subject as:

Subject: Discovery Information Available For Case 0YG0T4S On Defendant Michael
Gray
Between Michael and Gray is a Hard Carriage Return. As a result, the Subject that you showed me how to retrieve does not return the entire line of data.

How may I tweak the existing script so that this is no longer an issue? Here's the relevant part of your fantastic script!


Code:
Set Reg1 = CreateObject("VBScript.RegExp")
    With Reg1
        .Pattern = "(Subject:\s(.*))"
        .Global = True
    End With
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
You'd use \r at the pattern - i think it's \r, but if it doesn't work, try \n.
.Pattern = "(Subject:\s(.*)\r(.*))"

The only problem is it might pick up part of the next line.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
BTW - since you only have one subject line in the header, use folder for global. It ill stop checking the header when it finds the first entry.
 
Outlook version
Outlook 2013 64 bit
Email Account
Exchange Server
Well. Now I’ve messed up royally! After making the change, I ran the script on my CALENDAR! Any idea how to undo that?! (I’ll be getting out of VBA after this I think)
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
I don't think I've done that before... <g> but will see if there is a second property we can read - there should be something.
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
The subject is in the appointment 3 times... once as a conversation topic. Using that as the propertyAccessor in the oops code should work. I'll test it.
2857
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
:( Conversation index works - but only for meetings.

I changed strheader to strtemp and removed the regex.
Code:
strTemp = propertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x0070001E")
aItem.Subject = strTemp
 
Last edited:
Outlook version
Outlook 2013 64 bit
Email Account
Exchange Server
Good morning Diane.

I have to fix one more thing but I'm going to start a fresh thread with it.

thanks!
 
Top