Can not change email body content on Outlook 2010

Status
Not open for further replies.
T

Tom

Hi,

I've VBA sub to change content for incoming email. That works fine on

Outlook 2007 but not 2010. The VBA code is:

=============================================

Sub test()

Dim ns As NameSpace

Dim Inbox As MAPIFolder

Dim Item As Object

Set ns = GetNamespace("MAPI")

Set Inbox = ns.GetDefaultFolder(olFolderInbox)

Set Item = Inbox.Items.Item(1)

Item.Body = "Test" & Item.Body

End Sub

=============================================

After running the email content in Outlook 2007 add "Test" at the beginning

of the email. But in Outlook 2010 it does nothing.

Any suggestion? Thanks in advence!

Tom
 
S

Sue Mosher [MVP]

You need to call Item.Save after changing the item's content.

Sue Mosher

"Tom" <Tom> wrote in message

news:98795E66-6DD8-410F-B4A3-80EA99F8C616@microsoft.com...
> Hi,

> I've VBA sub to change content for incoming email. That works fine on
> Outlook 2007 but not 2010. The VBA code is:

> =============================================
> Sub test()
> Dim ns As NameSpace
> Dim Inbox As MAPIFolder
> Dim Item As Object

> Set ns = GetNamespace("MAPI")
> Set Inbox = ns.GetDefaultFolder(olFolderInbox)

> Set Item = Inbox.Items.Item(1)

> Item.Body = "Test" & Item.Body
> End Sub
> =============================================

> After running the email content in Outlook 2007 add "Test" at the
> beginning
> of the email. But in Outlook 2010 it does nothing.

> Any suggestion? Thanks in advence!

> Tom
>
 
T

Tom

Thanks Sue! That's really help!

"Sue Mosher [MVP]" wrote:


> You need to call Item.Save after changing the item's content.
> > Sue Mosher
> > >

> "Tom" <Tom> wrote in message
> news:98795E66-6DD8-410F-B4A3-80EA99F8C616@microsoft.com...
> > Hi,
> > I've VBA sub to change content for incoming email. That works fine on
> > Outlook 2007 but not 2010. The VBA code is:
> > =============================================
> > Sub test()
> > Dim ns As NameSpace
> > Dim Inbox As MAPIFolder
> > Dim Item As Object
> > Set ns = GetNamespace("MAPI")
> > Set Inbox = ns.GetDefaultFolder(olFolderInbox)
> > Set Item = Inbox.Items.Item(1)
> > Item.Body = "Test" & Item.Body
> > End Sub
> > =============================================
> > After running the email content in Outlook 2007 add "Test" at the
> > beginning
> > of the email. But in Outlook 2010 it does nothing.
> > Any suggestion? Thanks in advence!
> > Tom
> >


> .
>
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
M rule to change subject, pull email addresses from body, and forward with templ Using Outlook 14
L Script to: Change subject of email after checking body Using Outlook 2
E How to display "Change Folder" in Change Default Email Delivery Location in Exchange Outlook 2016 Using Outlook 1
S Change VBA script to send HTML email instead of text Outlook VBA and Custom Forms 3
B Change font of reminder of an email header Outlook VBA and Custom Forms 3
S Email Format With Embedded Images and Tables Change Using Outlook 2
O On click,I want to change subject line of selected mail and then reply to particular email and move Using Outlook 3
H Change Default Email Account Using VBA Outlook VBA and Custom Forms 5
R Outlook 2016 - How to change password in MS Exchange email client Using Outlook 0
J Format change when dragging from email to Task Using Outlook 1
Fozzie Bear Change the colour or font of individual email accounts in outlook 2010/13 Using Outlook 1
B Change default email for address book Using Outlook 1
Maybear Sudden change in Outlook, no image display, email no longer offers suggestions for address Using Outlook 8
P Automatically 'Reply to all', and Change the Subject of Email - Diane P help! Using Outlook 0
D Outlook 2010: Change the font for the area at the top of an open email. Using Outlook 1
H Disaster. Management wants to change email format. Exchange Server Administration 9
M How do you change the obnoxious color of the email headers on Outlook 2013? Using Outlook 2
M Rules - daily status (email) doesn't change much daily, save 1 per week how? Using Outlook 1
K Change default "Display As" for contact email addresses Using Outlook 1
J Change Email Account Outlook VBA and Custom Forms 5
D Change FROM email Outlook VBA and Custom Forms 5
V change the Default email Delivery Location Outlook VBA and Custom Forms 3
S Change "This Week" flag start date behavior Using Outlook 1
N Help creating a VBA macro with conditional formatting to change the font color of all external emails to red Outlook VBA and Custom Forms 5
D Change Microsoft Account password - what to do to update on all devices Using Outlook 4
S Outlook 2016 Change how Outlook shows me contacts in emails Using Outlook 0
witzker HowTo Change message Class of contact form Outlook VBA and Custom Forms 0
Z Outlook 365 delete reminder you can’t make change to contents of this-read only folder Using Outlook 4
witzker Pls help to change the code for inserting date in Ol contact body Outlook VBA and Custom Forms 5
R How to Change Margins In Google Docs...? New Slipstick.com Articles 0
e_a_g_l_e_p_i Outlook 2010 How can I change the font size on right side appointment pane Using Outlook 12
diver864 vba for a rule to automatically accept meeting requests with 'vacation' in subject, change to all-day event, change to free, don't send reply Outlook VBA and Custom Forms 1
B Change Font and Font size using VBA Outlook VBA and Custom Forms 9
D Change senders title Using Outlook 1
W Recurrence: delete older occurrences / change earliest start time Outlook VBA and Custom Forms 0
E Change sending account depending on Subjectline Outlook VBA and Custom Forms 0
J Outlook 2013 Change color of text in data fields of contacts in Outlook 2013? Using Outlook 10
B Change row background color of selected item Using Outlook 1
PGSystemTester VBA To Change AppointmentItem.BusyStatus From MeetingItem Before Send Using Outlook 0
B Change from Address Outlook VBA and Custom Forms 0
X If you change expiration date of repeated task it dupplicates Using Outlook 1
B See "Change View" Drop Down as a List? Using Outlook 1
V Change start time based on message duration Outlook VBA and Custom Forms 2
R Folder pane width change Using Outlook 62
S Outlook 2010 unable to change default font Using Outlook 7
P How can I change my calendar view back Using Outlook 3
A Edit subject - and change conversationTopic - using VBA and redemption Outlook VBA and Custom Forms 2
T Change the selected Message in the Outlook window Outlook VBA and Custom Forms 2
geofferyh How to change the Attachment File Name? Outlook VBA and Custom Forms 1
W Appointment occurrences change the location property Using Outlook 0

Similar threads

Top