A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Outlook and VBA
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Archiving



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old March 2nd 06, 07:49 PM posted to microsoft.public.outlook.program_vba
Jordan
external usenet poster
 
Posts: 18
Default Archiving

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
Ads
  #2  
Old March 2nd 06, 08:07 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Archiving

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
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"Jordan" wrote in message ...
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

  #3  
Old March 2nd 06, 08:55 PM posted to microsoft.public.outlook.program_vba
Jordan
external usenet poster
 
Posts: 18
Default Archiving

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.

"Sue Mosher [MVP-Outlook]" wrote:

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
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"Jordan" wrote in message ...
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


  #4  
Old March 2nd 06, 09:30 PM posted to microsoft.public.outlook.program_vba
Sue Mosher [MVP-Outlook]
external usenet poster
 
Posts: 11,651
Default Archiving

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
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx


"Jordan" wrote in message ...
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.

"Sue Mosher [MVP-Outlook]" wrote:

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.



"Jordan" wrote in message ...
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


 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
archiving Bill H. Outlook - General Queries 3 February 27th 06 01:52 PM
Archiving email - Searchable [email protected] Outlook - General Queries 1 February 24th 06 04:49 PM
ARCHIVING EMAIL ERRORS dharvey Outlook - Installation 0 February 10th 06 05:00 PM
Mail disappearing during archiving Paul W. Outlook - General Queries 0 January 26th 06 05:30 PM
Archiving mcp6453 Outlook Express 1 January 21st 06 03:26 AM


All times are GMT +1. The time now is 11:05 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.