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
-
 
Back
Top