
Removal of attachments on email items in Sent items folder
You must have a myItem.Save statement somewhere to save your changes. Where
did you put it?
Did you try using a For Each ... Next loop, as I suggested?
--
Sue Mosher
Author of
"Teach Yourself Microsoft Outlook 2000 Programming in 24 Hours"
"Microsoft Outlook 2000 E-mail and Fax Guide"
Outlook and Exchange solutions at http://www.slipstick.com
Quote:
> Thanks Sue,
> I already tried "myItem.save" with no error but no save was performed.
> It seems I am missing someting else.
> I have been looking that matter with some programmers; no luck yet !
> Should I consider replacing my programmers ??????
> No kidding, do you have more details to save my items ?
> Thanks in advance
> Francois Phaneuf
> > > Hi,
> > > I am new to Outlook VBA...or any VBA.
> > > I'm working on a macro that will permanently delete all attachments
from
> a
> > > "Sents items" folder.
> > > Here is what I came-up with:
> > > ______________________________
> > > Sub a()
> > > compte = 0
> > > counter = 0
> > > Set myOlApp = CreateObject("Outlook.Application")
> > > Set myNameSpace = myOlApp.GetNamespace("MAPI")
> > > Set myFolder = myNameSpace.GetDefaultFolder(olFolderSentMail)
> > > Set mynewfolder = myFolder.Folders("Test")
> > > compte = mynewfolder.Items.Count + 1
> > > Do While counter < compte ' Inner loop.
> > > counter = counter + 1
> > > Set myItem = mynewfolder.Items(counter)
> > > Set myAttachments = myItem.Attachments
> > > While myAttachments.Count > 0
> > > myAttachments.Remove 1
> > > Wend
> > > Loop
> > > End Sub
> > > _______________________-
> > > It has a couple of flaws, but it works;as long as it is running....
> > > I stepped through-it, and the attachments do disappear, but when the
> macro
> > > is ended, all the attachment re-appear !
> > > How can I fix this ?
> > > Thanks in advance.
> > > Francois Phaneuf