Archiving

G

Guest

I have created the code below with help from a previous post. I have two
additional questions. (1) Is there a way to mark Noaging to False if
currently True and True if currently False and (2) This code only works if
I'm on a mail item. Is there a way to have it work on a task (or other
items) as well.

Any and all help will be greatly appreciated. Thanks.

Sub OnOff()
Dim oMail As MailItem
Set oMail = Application.ActiveExplorer.Selection(1)

oMail.NoAging = True
oMail.Save
End Sub
 
S

Sue Mosher [MVP-Outlook]

1)

oMail.NoAging = (Not oMail.NoAging )

2) All Outlook items support the NoAging property. The problem is that your code assumes that the item selected is a MailItem. Dim oMail as Object instead.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
G

Guest

Sue, Thank you very much. Both answers work perfect. While I was waiting
for an answer, I figured out I could use an If Else statement, but this is
much cleaner. Thank you.

Just out of curiosity. The reason I needed the macro is because it wont let
you just click the icon for the do not archive in the mail list and I just
noticed it will on the tasks. Do you know why? Could it be a setting that
I'm not seeing. This may elimanate the need for the macro.

Again, Thanks for your help.
 
S

Sue Mosher [MVP-Outlook]

Tasks views are generally set up for in-cell editing by default. Mail views are not.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

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

Top