Outlook 2003 VBA Won't Run In Outlook 2010

Status
Not open for further replies.

GeoffD

New Member
Outlook version
Outlook 2010 32 bit
Email Account
POP3
I created a macro for inserting a date and time stamp on the front end of an e-mails subject, see below for code. The purpose of the macro is to time stamp the subject of each individual email in a folder (eg. the Inbox), so that they can be dragged and dropped into a hard drive / server / dvd folder and will then be listed in chronological order, dependent upon when they were sent.

After updating to Outlook 2010 from 2003, the code which used to operate flawlessly now falls over on the "mItem.Save" line, giving an error message:

Run-time error '-2147221239 (80040109)':

The operation cannot be performed because the message has been changed.


I'm assuming the command has been modified or updated but would be grateful for any assistance in debugging? The code reads:


Sub AddDateToSubject()
Dim mItem As Object
Dim oFolder As Object
Dim j As Long
Set myOlApp = CreateObject("Outlook.Application")
Set myNameSpace = myOlApp.GetNamespace("MAPI")
Set myFolder = ActiveExplorer.CurrentFolder
For j = myFolder.Items.Count To 1 Step -1
Set mItem = myFolder.Items.Item(j)
If TypeName(mItem) = "MailItem" Then
If Left(mItem.Subject, 12) <> Format(mItem.SentOn, "YYYYMMDDhhmm") Then
mItem.Subject = Format(mItem.SentOn, "YYYYMMDDhhmm") & " " & mItem.Subject
mItem.Save
End If
End If
Next j

Set mItem = Nothing
Set myFolder = Nothing
End Sub​
 

GeoffD

New Member
Outlook version
Outlook 2010 32 bit
Email Account
POP3
Thanks for responding Diane, much appreciated. I haven't loaded or activated any additional addins since moving from Office 2003 to 2010 but whether there are any additionally operating by default, I couldn't tell you?
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Go to File, Options, Trust Center, Addins to check - if its just the defaults, it wouldn't affect it.

Move or copy a few messages to a new folder and test it on them - you could test it on messages in a new pst file too.
 

GeoffD

New Member
Outlook version
Outlook 2010 32 bit
Email Account
POP3
Bingo! It was an anti virus addin that was affecting it. Though I did need to remove the line "Set myFolder = myNameSpace.ActiveExplorer.CurrentFolder" too. Many thanks for your time and assistance
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
J How to set a flag to follow up using VBA for outlook 2003 Using Outlook 10
P Outlook 2003 - Regra em VBA Outlook VBA and Custom Forms 1
P 'Trusted' VBA code in Outlook 2003? Outlook VBA and Custom Forms 2
M VBA Form how to load in Outlook 2003 Outlook VBA and Custom Forms 4
R Outlook 2003/2007 Rule and Conditions for InBox VBA customization Outlook VBA and Custom Forms 3
I Outlook 2003 shows html code when To: field is empty Using Outlook 5
B Outlook 2003 email sending & receiving suddenly stopped working Using Outlook 3
H Outlook 2003 find by "has attachment" Using Outlook 1
glnz How set up new IMAP on Outlook-Office 365 and merge in pst from Outlook 2003 for same two email accounts? Using Outlook 5
P Import Categories from Outlook 2003 Using Outlook 8
V Outlook 2003 problem with Windows 10 Creators Update 1709 Using Outlook 0
M Outlook 2003 pictures - some visible, some not Using Outlook 0
S Outlook 2003 to Outlook 2013 pst file Using Outlook 5
O Memory Leak in Outlook 2003 Using Outlook 3
W Changing looks of emails in Outlook 2003 Using Outlook 0
O Outlook 2003 can't send, but settings seem OK Using Outlook 1
P URL Hyperlink not working correctly in Outlook 2003 Using Outlook 10
O Outlook 2003 can't open contacts. Using Outlook 2
O Promoting Outlook 2003 User Templates Using Outlook 1
O W-a-a-y too many PSTs (Outlook 2003) Using Outlook 0
J Outlook 2003-2010 PST Field Editor Using Outlook 1
P Outlook 2003 - Do I need a new profile? Using Outlook 2
E Want to Import Outlook 2003 pst files to later version Using Outlook 6
A error message outlook 2003 Using Outlook 1
B Seeking advice now Outlook 2003 is unsupported by Exchange Using Outlook 4
O Change Debit to Credit in Outlook 2003? Using Outlook 1
J problems downloading POP3 emails to Outlook 2003 Using Outlook 1
P Outlook 2003 - possible to recreate corrupt account? Using Outlook 3
Calvyn Outlook 2003 cannot import .vcs subject Using Outlook 1
T Query about one aspect of migrating .pst files from Outlook 2003 to Outlook 2013 Using Outlook 5
C Outlook 2003 contacts Using Outlook 1
G Configuring Outlook 2003 for Gmail with both pop3 & imap4 accounts Using Outlook 1
M HELP--Extract Data from 2003 outlook transfer to excel spreadsheet Using Outlook 1
V Outlook 2003 editing problem Using Outlook 4
X Outlook 2003 not sending all of the new email message Using Outlook 1
2 How to use outlook 2003 calendar in always offline mode Using Outlook 0
G Outlook 2003 I need to move email to folder based on subject, using wild card Using Outlook 0
G outlook 2013 - Open In Outlook 2003 Using Outlook 1
A Exchange 2003 Outlook 2010 64 Bit- AutoDiscover Connection Err - Certificate Exchange Server Administration 9
T Use Outlook 2003 with Office 2013 Using Outlook 1
D Outlook 2003 contact folder opend in scrolled down position Using Outlook 2
O Need advice ASAP! Outlook 2003. Using Outlook 1
H Custom Contact form not working in Outlook 2003 Using Outlook 3
O Outlook 2003 forms problem Using Outlook 3
O Duplicate folders in Outlook 2003 Using Outlook 3
O Moving OUtlook 2003 from bad XP to Win 7 Pro 64 -- URGENT! Using Outlook 8
A File - Save Attachments does nothing in Outlook 2003 with Exchange 2010 ... Using Outlook 3
R Menus in a new\old email not there in Outlook 2003 Using Outlook 2
R OUTLOOK 2003 on WinXP, Prob: CONTACTS or ADDRESS BOOK not connected or missing Using Outlook 6
R Outlook 2003 not working Using Outlook 13

Similar threads

Top