GuruGary
asked on
How can we remove BCC information from Outlook .MSG files
We have some archived MSG files, and some of them contain BCC information which I have been asked to remove for security reasons. Is there a tool to strip this information, or a way to re-save the files from Outlook? Outlook version is 2003, and we have identified about 50 .MSG files that contain BCC information.
Hi, GuruGary.
There's no tool for doing this. It's easy enough to do this though. Double-click on a .msg file and it will open in Outlook. Save the message into Outlook. Once all the messages are in an Outlook folder select them all and run the following script. It'll remove all the BCC addresses. You'll then have to save the messages as .msg files when you're done.
Follow these instructions to add the code to Outlook.
1. Start Outlook
2. Click Tools > Macro > Visual Basic Editor
3. If not already expanded, expand Microsoft Office Outlook Objects
4. If not already expanded, expand Modules
5. Select an existing module (e.g. Module1) by double-clicking on it or create a new module by right-clicking Modules and selecting Insert > Module.
6. Copy the code from the Code Snippet box and paste it into the right-hand pane of Outlook's VB Editor window
7. Edit the code as needed. I included comments wherever something needs to or can change
8. Click the diskette icon on the toolbar to save the changes
9. Close the VB Editor
Because this script accesses an address field it will trigger Outlook's buil-in security. The result will be a dialog-box warning that a program is accessing your mailbox and asking for your permission to continue. Say yes.
There's no tool for doing this. It's easy enough to do this though. Double-click on a .msg file and it will open in Outlook. Save the message into Outlook. Once all the messages are in an Outlook folder select them all and run the following script. It'll remove all the BCC addresses. You'll then have to save the messages as .msg files when you're done.
Follow these instructions to add the code to Outlook.
1. Start Outlook
2. Click Tools > Macro > Visual Basic Editor
3. If not already expanded, expand Microsoft Office Outlook Objects
4. If not already expanded, expand Modules
5. Select an existing module (e.g. Module1) by double-clicking on it or create a new module by right-clicking Modules and selecting Insert > Module.
6. Copy the code from the Code Snippet box and paste it into the right-hand pane of Outlook's VB Editor window
7. Edit the code as needed. I included comments wherever something needs to or can change
8. Click the diskette icon on the toolbar to save the changes
9. Close the VB Editor
Because this script accesses an address field it will trigger Outlook's buil-in security. The result will be a dialog-box warning that a program is accessing your mailbox and asking for your permission to continue. Say yes.
Sub RemoveAddresses()
Dim olkMsg As Object, olkRecipient As Outlook.Recipient
For Each olkMsg in Outlook.ActiveExplorer.Selection
For Each olkRecipient In olkMsg.Recipients
If olkRecipient.Type = olBCC Then
olkRecipient.Delete
End If
Next
Next
olkMsg.Save
Set olkRecipient = Nothing
Set olkMsg = Nothing
End Sub
ASKER
Hi, BlueDevilFan. Your solution looks like it can work for me. I tried your suggestion, but the steps were a little different on my Outlook. There was not a "Modules" object in the beginning, but I used "Insert Module" from one of the drop-downs on the toolbar. When I double-click on Module1, it pulls up a new window (undocked, single-pane), but it looks like a window where your code would go. I pasted the code, saved it and went to where I had imported the messaged into Outlook.
I selected some messages, clicked Tools -> Macro -> Macros and "RemoveAddresses" was on the list (so far, so good), but when I clicked on the "Run" button, I got "Run-time error '91'; Object variable or With block variable not set" and clicking on "debug" highlights the olkMsg.Save line. I tried moving the olkMsg.Save to inside the IF and also inside the FOR EACH, and they both make the error go away, but I still have the BCC.
Any ideas?
I selected some messages, clicked Tools -> Macro -> Macros and "RemoveAddresses" was on the list (so far, so good), but when I clicked on the "Run" button, I got "Run-time error '91'; Object variable or With block variable not set" and clicking on "debug" highlights the olkMsg.Save line. I tried moving the olkMsg.Save to inside the IF and also inside the FOR EACH, and they both make the error go away, but I still have the BCC.
Any ideas?
Apologies. Looks like I put a line in the wrong place. Swap the position of lines 9 and 10.
ASKER
I already tried that and it didn't work. I just tried it again, and get no error, but BCC remains. After testing some more, I noticed that if I select a single message and run it it removes the BCC. If I select multiple messages and run the macro it does not work on the selection. So it is working on individual messages. I will start going through them 1-at-a-time, but if you have any suggestions on how to get a group to go all at once, please let me know.
Thanks again for your help!
Thanks again for your help!
Don't doubt what you're saying, but can't imagine how it's possible. I tested just now on multiple messages and it removed all the BCCs correctly.
ASKER
I just went through them all manually. Some still had BCC info, so I went through those again. But I think I figured out the issue ... does the script maybe just remove 1 BCC recipient with each pass?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks!
You're welcome.
Someone asked a similar questions here:
https://www.experts-exchange.com/questions/22134436/Is-there-a-way-of-editing-an-msg-file.html
Maybe you can achive this with a hex editor, e. g. http://www.hhdsoftware.com/Products/home/hex-editor-free.html