Outlook 2007 - Email Question - POP3 to IMAP

Rowdy

Member
Outlook version
Outlook 2007
Email Account
POP3
Hi,

I recently set up aol account with Outlook and by accident set it for POP3 so it deleted all 24000 emails on the server and downloaded to my computer. I tried to change it to IMAP but it doesn't let me, so I created a new IMAP account and have been dragging all the emails to the new account but it keeps freezing up and not transferring all of them. Is there an easier way because now my email on aol is all messed up.

Also - Outlook renamed a lot of emails to have [SPAM]: in the subject line and the emails transferred back to aol now say [SPAM]: and more of those emails are being sent to my spam folder even new incoming ones. I need a VBA macro to remove this string from a couple thousand emails and delete leading spaces. I can't seem to get any macro to work (even after disabling security). Please assist.

Thanks
Rowdy
 

Forum Admin

Senior Member
Outlook didn't add the spam tag - an antispam addin did. (Assuming AOL didn't.) A macro to fix it is here -
http://www.slipstick.com/outlook/email/add-a-file-number-or-keyword-to-the-subject-line-of-messages/

Replace the 3 lines beginning with For each with the following - it runs on all messages in the selected folder - i recommend testing it on a folder with few messages so you are sure its calculating the correct subject length. Create a new folder and copy a few messages to it.



For Each aItem In mail.Items

' use the exact same text, including case
if instr(1, aitem.subject, "[Spam]") > 0 then

' replace 7 with the correct length, including spaces
strTemp = right(aItem.Subject, len(aitem.subject) -7)
aItem.Subject = strTemp

'rest of macro

End if

How many messages are you moving at once? Any sync error messages?

(Updated Sept 27 to fix problem Michael mentioned.)



Sent from my Venue 8 Pro 5830 using Tapatalk
 

Michael Bauer

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
if instr(1, aitem.subject, "[Spam]") > 0 then
For Each aItem In mail.Items

Assuming aItem is valid, that is set to an item in the folder, the above checks for "spam" in one item, then replaces the subject for all items no matter whether or not "spam" is contained. If that's not intended, the lines need to be switched.
 

Rowdy

Member
Outlook version
Outlook 2007
Email Account
POP3
Ok, I managed to finish moving all messages to the IMAP account, but now think I messed up the .pst file when I was trying to change the name of the email account because it had a (1) in it so now outlook just freezes everytime I open it. I'm going to try to go into safe mode to rename it back later today but how would I get rid of the bad name?

As for the VBA code to remove spam, I can't get the code to work.

Sub AddFileNumber() Dim myolApp As Outlook.Application Dim aItem As Object
Set myolApp = CreateObject("Outlook.Application") Set mail = myolApp.ActiveExplorer.CurrentFolder
Dim iItemsUpdated As Integer Dim strTemp As String Dim strFilenum As String

strFilenum = InputBox("Enter the file number")
iItemsUpdated = 0
if instr(1, aitem.subject, "[Spam]") > 0 then
For Each aItem In mail.Items
strTemp = right(aItem.Subject, len(aitem.subject) -8)
aItem.Subject = strTemp
aItem.Save Next aItem

MsgBox iItemsUpdated & " of " & mail.Items.Count & " Messages Updated" Set myolApp = Nothing End Sub
 

Rowdy

Member
Outlook version
Outlook 2007
Email Account
POP3
Macro keeps giving me a compile error with every line.
 

Rowdy

Member
Outlook version
Outlook 2007
Email Account
POP3
Now I'm getting Runtime Error 91 with:

If InStr(1, aItem.Subject, "[Spam]:") > 0 Then
 

Rowdy

Member
Outlook version
Outlook 2007
Email Account
POP3
Sub AddFileNumber()

Dim myolApp As Outlook.Application
Dim aItem As Object
Set myolApp = CreateObject("Outlook.Application")
Set mail = myolApp.ActiveExplorer.CurrentFolder
Dim iItemsUpdated As Integer
Dim strTemp As String

iItemsUpdated = 0
If InStr(1, aItem.Subject, "[Spam]:") > 0 Then
For Each aItem In mail.Items
strTemp = Right(aItem.Subject, Len(aItem.Subject) - 8)
aItem.Subject = strTemp
aItem.Save
Next aItem
Set myolApp = Nothing

End If

End Sub
 

Rowdy

Member
Outlook version
Outlook 2007
Email Account
POP3
Upon swapping those lines I get a compile error: Next without For.

Sub AddFileNumber()
Dim myolApp As Outlook.Application
Dim aItem As Object
Set myolApp = CreateObject("Outlook.Application")
Set mail = myolApp.ActiveExplorer.CurrentFolder
Dim iItemsUpdated As Integer
Dim strTemp As String
iItemsUpdated = 0
For Each aItem In mail.Items
If InStr(1, aItem.Subject, "[Spam]:") > 0 Then
strTemp = Right(aItem.Subject, Len(aItem.Subject) - 8)
aItem.Subject = strTemp
aItem.Save
Next aItem '<<<<<<<<---------
Set myolApp = Nothing
End If
End Sub
 

Rowdy

Member
Outlook version
Outlook 2007
Email Account
POP3
I fixed the problem, had part of the if then statement out of the loop. THANKS SO MUCH!
 
Top