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. |
|
|
Thread Tools | Display Modes |
#21
|
|||
|
|||
Check your macro security settings (Tools | Macro | Security). VBA code =
won't run if it's set to high, which is the default. Restart Outlook if = you change it. I keep mine set to Medium so I get an authorization = prompt that lets me know that VBA has kicked in.=20 --=20 Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for=20 Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "stephanie" wrote in message = ... Very cool. I've never driven VB of any kind. =20 OK. I pasted everything from "Dim.." to the end of the second = "EndSub" into=20 the window that calls itself "ThisOutlookSession." =20 I saved the project. Closed and reopened Outlook.=20 =20 My "Deleted" column is still filled with "None." =20 What else do I need to do to make it take? =20 Or...? =20 =20 =20 "Sue Mosher [MVP-Outlook]" wrote: =20 Unfortunately, Outlook lets you do things in the UI that just don't = work as you would logically expect them to. In particular, creating a = field doesn't put data into it. Just because you name a field "Deleted," = Outlook doesn't know *what* data to put into it.=20 =20 This code, however, will watch the Deleted Items folder for new = items. When one arrives, it will add the Deleted property to that item = and then set the value of that property to the current date/time. =20 Dim WithEvents colDelItems As Outlook.Items =20 Private Sub Application_Startup() Dim objNS As Outlook.NameSpace Set objNS =3D Application.GetNamespace("MAPI") Set colDelItems =3D = objNS.GetDefaultFolder(olFolderDeletedItems).Items Set objNS =3D Nothing End Sub =20 Private Sub colDelItems_ItemAdd(ByVal Item As Object) On Error Resume Next Set objField =3D Item.UserProperties.Add("Deleted", olDateTime) objField.Value =3D Now Item.Save Set objField =3D Nothing End Sub =20 Add the code to the built-in ThisOutlookSession module in Outlook VBA = and make sure your macro security is not set to High. =20 =20 LookOut has a Search button, not Find, but it sounds like you have = some other search tool that might serve you just as well.=20 =20 BTW, if you don't want to manually empty the trash every week, set = the Deleted Items folder to delete items older than 7 days whenever = AutoArchive runs. I have AutoArchive set up to run every day and delete = items in Deleted Items that are older than a week.=20 |
#22
|
|||
|
|||
Thanks for the path. ("macro security" wasn't capitalized, so I thought you
meant overall security. And I didn't realize that the VBA script was a macro.) Ok. I’ve changed my Macro Security to medium. Closed and Reopened OL. Tried “Enable …” Closed and Reopened OL. Tried “Disable…” Closed and Reopened OL. Went back to the VBA screen. Set (General) to “colDelItems.” And (Declarations) to “ItemAdd.” Closed and Reopened OL. Nothing has changed in my Deleted Items screen. When I went back to the VBA screen,(General) and (Declarations) had reverted to “(General)” and “(Declarations).” What next? Thanks for all your patience. I have time to mess with this right now; I think it will prove to have real value in the future. When I need this function, it is always a moment of stress, if not crisis. "Sue Mosher [MVP-Outlook]" wrote: Check your macro security settings (Tools | Macro | Security). VBA code won't run if it's set to high, which is the default. Restart Outlook if you change it. I keep mine set to Medium so I get an authorization prompt that lets me know that VBA has kicked in. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "stephanie" wrote in message ... Very cool. I've never driven VB of any kind. OK. I pasted everything from "Dim.." to the end of the second "EndSub" into the window that calls itself "ThisOutlookSession." I saved the project. Closed and reopened Outlook. My "Deleted" column is still filled with "None." What else do I need to do to make it take? Or...? "Sue Mosher [MVP-Outlook]" wrote: Unfortunately, Outlook lets you do things in the UI that just don't work as you would logically expect them to. In particular, creating a field doesn't put data into it. Just because you name a field "Deleted," Outlook doesn't know *what* data to put into it. This code, however, will watch the Deleted Items folder for new items. When one arrives, it will add the Deleted property to that item and then set the value of that property to the current date/time. Dim WithEvents colDelItems As Outlook.Items Private Sub Application_Startup() Dim objNS As Outlook.NameSpace Set objNS = Application.GetNamespace("MAPI") Set colDelItems = objNS.GetDefaultFolder(olFolderDeletedItems).Items Set objNS = Nothing End Sub Private Sub colDelItems_ItemAdd(ByVal Item As Object) On Error Resume Next Set objField = Item.UserProperties.Add("Deleted", olDateTime) objField.Value = Now Item.Save Set objField = Nothing End Sub Add the code to the built-in ThisOutlookSession module in Outlook VBA and make sure your macro security is not set to High. LookOut has a Search button, not Find, but it sounds like you have some other search tool that might serve you just as well. BTW, if you don't want to manually empty the trash every week, set the Deleted Items folder to delete items older than 7 days whenever AutoArchive runs. I have AutoArchive set up to run every day and delete items in Deleted Items that are older than a week. |
#23
|
|||
|
|||
Is there a bootstrap for imagination?
"Brian Tillman" wrote: Sue Mosher [MVP-Outlook] wrote: At least in a .pst file, the Modified date won't tell you when an item was deleted. At least that's what I'm seeing on my machine. And on mine, it seems to show exactly that. I just added the "Modified" date to my Deleted Items folder and deleted two items at 1:06 PM that I received at 12:17 and 12:22 PM respectively. The Modified date shows "1:06 PM", just as I would expect. stephanie wrote: Unfortunately, in OL 2002, “modified” seems to correspond with the “sent” date/time. I don't have access to OL 2002 at the moment, so I used Outlook 2003. I usually don't save sent items, but I added the Modified Date to my Sent Items folder (so I could see it prior to deleting an item) and then sent some messages. The Modified date as displayed in the Sent Items folder certainly did not match the Sent date (the Modified date was about a minute later that the Sent date, as I would expect in many cases) I then waited a while and then deleted the items and examined the Deleted Items folder. Indeed, the Modified date changed to be the date I deleted the items (i.e., the date/time matched the point they were placed into the Deleted Items folder). So, as I suspected, at least for OL 2003, the modified date makes a reasonable approximation for the date and time of deletion. I can't imagine that it's any different for OL 2002. -- Brian Tillman |
#24
|
|||
|
|||
Oh, I've also made a new deletion. It appears in Deleted file, with "none"
in the "Deleted" column. "Sue Mosher [MVP-Outlook]" wrote: Check your macro security settings (Tools | Macro | Security). VBA code won't run if it's set to high, which is the default. Restart Outlook if you change it. I keep mine set to Medium so I get an authorization prompt that lets me know that VBA has kicked in. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "stephanie" wrote in message ... Very cool. I've never driven VB of any kind. OK. I pasted everything from "Dim.." to the end of the second "EndSub" into the window that calls itself "ThisOutlookSession." I saved the project. Closed and reopened Outlook. My "Deleted" column is still filled with "None." What else do I need to do to make it take? Or...? "Sue Mosher [MVP-Outlook]" wrote: Unfortunately, Outlook lets you do things in the UI that just don't work as you would logically expect them to. In particular, creating a field doesn't put data into it. Just because you name a field "Deleted," Outlook doesn't know *what* data to put into it. This code, however, will watch the Deleted Items folder for new items. When one arrives, it will add the Deleted property to that item and then set the value of that property to the current date/time. Dim WithEvents colDelItems As Outlook.Items Private Sub Application_Startup() Dim objNS As Outlook.NameSpace Set objNS = Application.GetNamespace("MAPI") Set colDelItems = objNS.GetDefaultFolder(olFolderDeletedItems).Items Set objNS = Nothing End Sub Private Sub colDelItems_ItemAdd(ByVal Item As Object) On Error Resume Next Set objField = Item.UserProperties.Add("Deleted", olDateTime) objField.Value = Now Item.Save Set objField = Nothing End Sub Add the code to the built-in ThisOutlookSession module in Outlook VBA and make sure your macro security is not set to High. LookOut has a Search button, not Find, but it sounds like you have some other search tool that might serve you just as well. BTW, if you don't want to manually empty the trash every week, set the Deleted Items folder to delete items older than 7 days whenever AutoArchive runs. I have AutoArchive set up to run every day and delete items in Deleted Items that are older than a week. |
#25
|
|||
|
|||
You might want to test whether any VBA code is running at all. You can =
try running a simple macro like this:=20 Sub HelloWorld() MsgBox "Hello world!" End Sub=20 Paste that into your VBA module, put the cursor inside it, then press = F5.=20 --=20 Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for=20 Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "stephanie" wrote in message = ... Oh, I've also made a new deletion. It appears in Deleted file, with = "none"=20 in the "Deleted" column. =20 "Sue Mosher [MVP-Outlook]" wrote: =20 Check your macro security settings (Tools | Macro | Security). VBA = code won't run if it's set to high, which is the default. Restart = Outlook if you change it. I keep mine set to Medium so I get an = authorization prompt that lets me know that VBA has kicked in.=20 =20 --=20 Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for=20 Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx =20 =20 "stephanie" wrote in message = ... Very cool. I've never driven VB of any kind. =20 OK. I pasted everything from "Dim.." to the end of the second = "EndSub" into=20 the window that calls itself "ThisOutlookSession." =20 I saved the project. Closed and reopened Outlook.=20 =20 My "Deleted" column is still filled with "None." =20 What else do I need to do to make it take? =20 Or...? =20 =20 =20 "Sue Mosher [MVP-Outlook]" wrote: =20 Unfortunately, Outlook lets you do things in the UI that just = don't work as you would logically expect them to. In particular, = creating a field doesn't put data into it. Just because you name a field = "Deleted," Outlook doesn't know *what* data to put into it.=20 =20 This code, however, will watch the Deleted Items folder for new = items. When one arrives, it will add the Deleted property to that item = and then set the value of that property to the current date/time. =20 Dim WithEvents colDelItems As Outlook.Items =20 Private Sub Application_Startup() Dim objNS As Outlook.NameSpace Set objNS =3D Application.GetNamespace("MAPI") Set colDelItems =3D = objNS.GetDefaultFolder(olFolderDeletedItems).Items Set objNS =3D Nothing End Sub =20 Private Sub colDelItems_ItemAdd(ByVal Item As Object) On Error Resume Next Set objField =3D Item.UserProperties.Add("Deleted", = olDateTime) objField.Value =3D Now Item.Save Set objField =3D Nothing End Sub =20 Add the code to the built-in ThisOutlookSession module in Outlook = VBA and make sure your macro security is not set to High. =20 =20 LookOut has a Search button, not Find, but it sounds like you have = some other search tool that might serve you just as well.=20 =20 BTW, if you don't want to manually empty the trash every week, set = the Deleted Items folder to delete items older than 7 days whenever = AutoArchive runs. I have AutoArchive set up to run every day and delete = items in Deleted Items that are older than a week.=20 =20 |
#26
|
|||
|
|||
"put the cursor inside it, then press F5" ??
Aha. Now we are getting somewhere. I went back and did that with the first script you gave me. And, aha again: I hadn't been here before - that's why I didn't suspect it was a macro. Another piece of info I'm missing: what are the rules for naming a macro? It doesn't like "deleted item date stamp" for a name. Thanks, Sue! "stephanie" wrote: Thanks for the path. ("macro security" wasn't capitalized, so I thought you meant overall security. And I didn't realize that the VBA script was a macro.) Ok. I’ve changed my Macro Security to medium. Closed and Reopened OL. Tried “Enable …” Closed and Reopened OL. Tried “Disable…” Closed and Reopened OL. Went back to the VBA screen. Set (General) to “colDelItems.” And (Declarations) to “ItemAdd.” Closed and Reopened OL. Nothing has changed in my Deleted Items screen. When I went back to the VBA screen,(General) and (Declarations) had reverted to “(General)” and “(Declarations).” What next? Thanks for all your patience. I have time to mess with this right now; I think it will prove to have real value in the future. When I need this function, it is always a moment of stress, if not crisis. "Sue Mosher [MVP-Outlook]" wrote: Check your macro security settings (Tools | Macro | Security). VBA code won't run if it's set to high, which is the default. Restart Outlook if you change it. I keep mine set to Medium so I get an authorization prompt that lets me know that VBA has kicked in. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "stephanie" wrote in message ... Very cool. I've never driven VB of any kind. OK. I pasted everything from "Dim.." to the end of the second "EndSub" into the window that calls itself "ThisOutlookSession." I saved the project. Closed and reopened Outlook. My "Deleted" column is still filled with "None." What else do I need to do to make it take? Or...? "Sue Mosher [MVP-Outlook]" wrote: Unfortunately, Outlook lets you do things in the UI that just don't work as you would logically expect them to. In particular, creating a field doesn't put data into it. Just because you name a field "Deleted," Outlook doesn't know *what* data to put into it. This code, however, will watch the Deleted Items folder for new items. When one arrives, it will add the Deleted property to that item and then set the value of that property to the current date/time. Dim WithEvents colDelItems As Outlook.Items Private Sub Application_Startup() Dim objNS As Outlook.NameSpace Set objNS = Application.GetNamespace("MAPI") Set colDelItems = objNS.GetDefaultFolder(olFolderDeletedItems).Items Set objNS = Nothing End Sub Private Sub colDelItems_ItemAdd(ByVal Item As Object) On Error Resume Next Set objField = Item.UserProperties.Add("Deleted", olDateTime) objField.Value = Now Item.Save Set objField = Nothing End Sub Add the code to the built-in ThisOutlookSession module in Outlook VBA and make sure your macro security is not set to High. LookOut has a Search button, not Find, but it sounds like you have some other search tool that might serve you just as well. BTW, if you don't want to manually empty the trash every week, set the Deleted Items folder to delete items older than 7 days whenever AutoArchive runs. I have AutoArchive set up to run every day and delete items in Deleted Items that are older than a week. |
#27
|
|||
|
|||
Oh-oh.
I'm working in Word. Just got a Microsoft Visual Basic error message: Run-time error '91': Object variable or With block variable not set. I don't know enough to understand the Help option. My other options are End or Debug. What shall I do? "Sue Mosher [MVP-Outlook]" wrote: You might want to test whether any VBA code is running at all. You can try running a simple macro like this: Sub HelloWorld() MsgBox "Hello world!" End Sub Paste that into your VBA module, put the cursor inside it, then press F5. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "stephanie" wrote in message ... Oh, I've also made a new deletion. It appears in Deleted file, with "none" in the "Deleted" column. "Sue Mosher [MVP-Outlook]" wrote: Check your macro security settings (Tools | Macro | Security). VBA code won't run if it's set to high, which is the default. Restart Outlook if you change it. I keep mine set to Medium so I get an authorization prompt that lets me know that VBA has kicked in. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "stephanie" wrote in message ... Very cool. I've never driven VB of any kind. OK. I pasted everything from "Dim.." to the end of the second "EndSub" into the window that calls itself "ThisOutlookSession." I saved the project. Closed and reopened Outlook. My "Deleted" column is still filled with "None." What else do I need to do to make it take? Or...? "Sue Mosher [MVP-Outlook]" wrote: Unfortunately, Outlook lets you do things in the UI that just don't work as you would logically expect them to. In particular, creating a field doesn't put data into it. Just because you name a field "Deleted," Outlook doesn't know *what* data to put into it. This code, however, will watch the Deleted Items folder for new items. When one arrives, it will add the Deleted property to that item and then set the value of that property to the current date/time. Dim WithEvents colDelItems As Outlook.Items Private Sub Application_Startup() Dim objNS As Outlook.NameSpace Set objNS = Application.GetNamespace("MAPI") Set colDelItems = objNS.GetDefaultFolder(olFolderDeletedItems).Items Set objNS = Nothing End Sub Private Sub colDelItems_ItemAdd(ByVal Item As Object) On Error Resume Next Set objField = Item.UserProperties.Add("Deleted", olDateTime) objField.Value = Now Item.Save Set objField = Nothing End Sub Add the code to the built-in ThisOutlookSession module in Outlook VBA and make sure your macro security is not set to High. LookOut has a Search button, not Find, but it sounds like you have some other search tool that might serve you just as well. BTW, if you don't want to manually empty the trash every week, set the Deleted Items folder to delete items older than 7 days whenever AutoArchive runs. I have AutoArchive set up to run every day and delete items in Deleted Items that are older than a week. |
#28
|
|||
|
|||
Ah. If you want to write code that responds to Outlook events, you need =
to write that code in Outlook's VBA environment, not Word's.=20 When you get an error, choose Debug. That will put you into the VBA = development environment with the problem statement highlighted. If you = need help understanding the cause of the error, copy that highlighted = statement and any above it that look like they might be relevant and = paste it into a message in any of the forums for discussing Outlook VBA = (see http://www.outlookcode.com/d/vb.htm#discuss)=20 --=20 Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for=20 Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "stephanie" wrote in message = ... Oh-oh. I'm working in Word. Just got a Microsoft Visual Basic error message:=20 =20 Run-time error '91': Object variable or With block variable not set. =20 I don't know enough to understand the Help option. My other options = are End=20 or Debug. =20 What shall I do? =20 "Sue Mosher [MVP-Outlook]" wrote: =20 You might want to test whether any VBA code is running at all. You = can try running a simple macro like this:=20 =20 Sub HelloWorld() MsgBox "Hello world!" End Sub=20 =20 Paste that into your VBA module, put the cursor inside it, then press = F5.=20 =20 "stephanie" wrote in message = ... Oh, I've also made a new deletion. It appears in Deleted file, = with "none"=20 in the "Deleted" column. =20 "Sue Mosher [MVP-Outlook]" wrote: =20 Check your macro security settings (Tools | Macro | Security). VBA = code won't run if it's set to high, which is the default. Restart = Outlook if you change it. I keep mine set to Medium so I get an = authorization prompt that lets me know that VBA has kicked in.=20 =20 "stephanie" wrote in message = ... Very cool. I've never driven VB of any kind. =20 OK. I pasted everything from "Dim.." to the end of the second = "EndSub" into=20 the window that calls itself "ThisOutlookSession." =20 I saved the project. Closed and reopened Outlook.=20 =20 My "Deleted" column is still filled with "None." =20 What else do I need to do to make it take? =20 Or...? =20 =20 =20 "Sue Mosher [MVP-Outlook]" wrote: =20 Unfortunately, Outlook lets you do things in the UI that just = don't work as you would logically expect them to. In particular, = creating a field doesn't put data into it. Just because you name a field = "Deleted," Outlook doesn't know *what* data to put into it.=20 =20 This code, however, will watch the Deleted Items folder for new = items. When one arrives, it will add the Deleted property to that item = and then set the value of that property to the current date/time. =20 Dim WithEvents colDelItems As Outlook.Items =20 Private Sub Application_Startup() Dim objNS As Outlook.NameSpace Set objNS =3D Application.GetNamespace("MAPI") Set colDelItems =3D = objNS.GetDefaultFolder(olFolderDeletedItems).Items Set objNS =3D Nothing End Sub =20 Private Sub colDelItems_ItemAdd(ByVal Item As Object) On Error Resume Next Set objField =3D Item.UserProperties.Add("Deleted", = olDateTime) objField.Value =3D Now Item.Save Set objField =3D Nothing End Sub =20 Add the code to the built-in ThisOutlookSession module in = Outlook VBA and make sure your macro security is not set to High. =20 =20 LookOut has a Search button, not Find, but it sounds like you = have some other search tool that might serve you just as well.=20 =20 BTW, if you don't want to manually empty the trash every week, = set the Deleted Items folder to delete items older than 7 days whenever = AutoArchive runs. I have AutoArchive set up to run every day and delete = items in Deleted Items that are older than a week.=20 =20 |
#29
|
|||
|
|||
Another piece of info I'm missing: what are the rules for naming a =
macro? =20 It doesn't like "deleted item date stamp" for a name. A VBA procedure name must be a single word that begins with an = alphabetic character.=20 If you're new to Outlook VBA coding, these web pages should help you get = some more practice:=20 http://www.winnetmag.com/Articles/In...3D21522&pg=3D1 http://www.outlookcode.com/d/vb.htm And I didn't realize that the VBA script was a macro. Technically, VBA is not a scripting language, and "macro" refers only to = a Public Sub procedure in VBA that has no arguments. Those, by the way, = are the only types of VBA procedures you will see in Macros list on the = Commands tab in View | Toolbars | Customize.=20 Ok. I=E2=80=99ve changed my Macro Security to medium. Closed and = Reopened OL. Tried =E2=80=9CEnable =E2=80=A6=E2=80=9D Closed and Reopened OL. Tried =E2=80=9CDisable=E2=80=A6=E2=80=9D Closed and Reopened OL. Went back to the VBA screen. Set (General) to = =E2=80=9CcolDelItems.=E2=80=9D And =20 (Declarations) to=20 =E2=80=9CItemAdd.=E2=80=9D Closed and Reopened OL. =20 Nothing has changed in my Deleted Items screen. =20 When I went back to the VBA screen,(General) and (Declarations) had = reverted=20 to =E2=80=9C(General)=E2=80=9D and =E2=80=9C(Declarations).=E2=80=9D That's normal for when you first start VBA. It reflects where your = cursor is in the code window.=20 What next? Thanks for all your patience. I have time to mess with = this=20 right now; I think it will prove to have real value in the future. = When I=20 need this function, it is always a moment of stress, if not crisis. I know what you mean! Time for poking around is essential. There never = seems to be enough of it, though.=20 --=20 Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for=20 Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx |
#30
|
|||
|
|||
VBA error '91':
I can't work in Word, and it won't let me open nother copy of Word, so I have to do SOMETHING. I can't understand HELP. When I selected DEBUG, the following line highlighted: Selection.TypeText Text:="MOM" Does that help? "Sue Mosher [MVP-Outlook]" wrote: You might want to test whether any VBA code is running at all. You can try running a simple macro like this: Sub HelloWorld() MsgBox "Hello world!" End Sub Paste that into your VBA module, put the cursor inside it, then press F5. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "stephanie" wrote in message ... Oh, I've also made a new deletion. It appears in Deleted file, with "none" in the "Deleted" column. "Sue Mosher [MVP-Outlook]" wrote: Check your macro security settings (Tools | Macro | Security). VBA code won't run if it's set to high, which is the default. Restart Outlook if you change it. I keep mine set to Medium so I get an authorization prompt that lets me know that VBA has kicked in. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "stephanie" wrote in message ... Very cool. I've never driven VB of any kind. OK. I pasted everything from "Dim.." to the end of the second "EndSub" into the window that calls itself "ThisOutlookSession." I saved the project. Closed and reopened Outlook. My "Deleted" column is still filled with "None." What else do I need to do to make it take? Or...? "Sue Mosher [MVP-Outlook]" wrote: Unfortunately, Outlook lets you do things in the UI that just don't work as you would logically expect them to. In particular, creating a field doesn't put data into it. Just because you name a field "Deleted," Outlook doesn't know *what* data to put into it. This code, however, will watch the Deleted Items folder for new items. When one arrives, it will add the Deleted property to that item and then set the value of that property to the current date/time. Dim WithEvents colDelItems As Outlook.Items Private Sub Application_Startup() Dim objNS As Outlook.NameSpace Set objNS = Application.GetNamespace("MAPI") Set colDelItems = objNS.GetDefaultFolder(olFolderDeletedItems).Items Set objNS = Nothing End Sub Private Sub colDelItems_ItemAdd(ByVal Item As Object) On Error Resume Next Set objField = Item.UserProperties.Add("Deleted", olDateTime) objField.Value = Now Item.Save Set objField = Nothing End Sub Add the code to the built-in ThisOutlookSession module in Outlook VBA and make sure your macro security is not set to High. LookOut has a Search button, not Find, but it sounds like you have some other search tool that might serve you just as well. BTW, if you don't want to manually empty the trash every week, set the Deleted Items folder to delete items older than 7 days whenever AutoArchive runs. I have AutoArchive set up to run every day and delete items in Deleted Items that are older than a week. |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Design help, please | SillySally | Using Forms | 27 | March 6th, 2005 04:11 AM |
If I create a form with the wizard and later decide I need to add another field do I have to re-create the form? | Mister John Doe | Using Forms | 3 | January 2nd, 2005 06:17 AM |
Autonumber | Ally H. | General Discussion | 7 | August 27th, 2004 04:51 PM |
field manipulation | Steve | Running & Setting Up Queries | 2 | May 28th, 2004 03:12 PM |