Subject will not update

  • Thread starter Thread starter ExcelLars
  • Start date Start date
E

ExcelLars

txtA = "[A] "
NewSubject = txtA & myOlSel.Item(x).Subject
myOlSel.Item(x).Subject = NewSubject
myOlSel.Item(x).Save

Why will not the subject not update with "[A]"?
 
Because you never save the changes.
Each time you call myOlSel.Item(x), you get back a brand new COM object.
You get one to set the Subject property, but never save the changes
You call Save on the second instance, but it never had any changes to begin
with.
Change your code to

txtA = "[A] "
set Item = myOlSel.Item(x)
NewSubject = txtA & myOlSel.Item(x).Subject
Item.Subject = NewSubject
Item.Save

--
Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
-
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top