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
S Outlook 365 Can I change the possible range of highlighting colours when writing an Outlook email? Using Outlook 1
V Can one change the formatting of email title blocks? Using Outlook 0
O What would be the recommended way to change an email address (family member)? Using Outlook 0
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
M Use Macro to change account settings Outlook VBA and Custom Forms 0
D Unable to change AppointmentItem.Start property Outlook VBA and Custom Forms 4
sjmo2 Change subject for new e-mails only. Outlook VBA and Custom Forms 2
Horsepower Contact phone numbers randomly change Using Outlook 0
P Outlook 2016 Change Paste Special Default Format Using Outlook 8
whizzard Change FROM address based on TO or CC address Outlook VBA and Custom Forms 8
S Unable to change Message Class Outlook VBA and Custom Forms 0
S New Outlook Appointment - Select All Body Text and Change Font and Size Outlook VBA and Custom Forms 1
J VBA Cannot programmatically input or change Value for User Defined field Using Outlook 1
C Outlook 365 Can you change the follow up colour? Using Outlook 1
A Change settings Send/receive VBA Outlook VBA and Custom Forms 0
E Outlook VBA change GetDefaultFolder dynamically Outlook VBA and Custom Forms 6
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...? Using Outlook 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

Similar threads

Top