<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Outlook VBA Code to Empty Deleted Items Folders</title>
	<atom:link href="http://sabarish.net/blog/archives/437/feed" rel="self" type="application/rss+xml" />
	<link>http://sabarish.net/blog/archives/437</link>
	<description>a place to read my thoughts and peek into my life and photos</description>
	<lastBuildDate>Sun, 13 May 2012 13:37:50 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Delain</title>
		<link>http://sabarish.net/blog/archives/437/comment-page-1#comment-49274</link>
		<dc:creator>Delain</dc:creator>
		<pubDate>Thu, 12 Apr 2012 14:03:47 +0000</pubDate>
		<guid isPermaLink="false">http://sabarish.net/?p=437#comment-49274</guid>
		<description>I&#039;ve been using this code for several months, but now it is only deleting from the main Deleted Items folder.
Here is the code with my other folder names inserted as you instructed:

Sub EmptyDeletedItems()
    &#039;Empties the default Mailbox Deleted Items Folder along with
    &#039;the Deleted Items folder in multiple Personal Folders / PSTs
    &#039; 11/11/11 -dg- found this on http://sabarish.net/blog/archives/437
    
    On Error GoTo ErrorHandler
    
    Dim objOutlookApp As Outlook.Application
    Dim mNameSpace As NameSpace
    Dim objExpl As Outlook.Explorer
    Dim objCBB As CommandBarButton
    Dim strEntryID As String
    Dim strStoreID As String
    
    Set objOutlookApp = CreateObject(&quot;Outlook.Application&quot;)
    Set mNameSpace = objOutlookApp.GetNamespace(&quot;MAPI&quot;)
    &#039;Set the explorer to the active explorer
    Set objExpl = objOutlookApp.ActiveExplorer
    &#039;Capture the original current folder Entry and Store ID&#039;s
    strEntryID = objExpl.CurrentFolder.EntryID
    strStoreID = objExpl.CurrentFolder.StoreID
    
    &#039;***Empty Main Deleted Items Folder
    &#039;Change the current folder to the target folder
    Set objExpl.CurrentFolder = mNameSpace.GetDefaultFolder(olFolderDeletedItems)
    &#039;Select the target folder
    objExpl.SelectFolder mNameSpace.GetDefaultFolder(olFolderDeletedItems)
    &#039;Get the Empty Deleted Items command = UID 1671
    Set objCBB = objExpl.CommandBars.FindControl(, 1671)
    &#039;Execute the command
    objCBB.Execute
    
    &#039;***Empty Personal Folders Deleted Items Folder
    &#039;***Copy this section as many times as there are the number of
    &#039;***different personal folders. -dg
    &#039;Change the current folder to the target personal folder / pst name
    Set personalFolder = mNameSpace.Folders(&quot;1 - PES Email&quot;)    &#039;Friends is the name of the Personal Folder
    Set objExpl.CurrentFolder = personalFolder.Folders(&quot;Deleted Items&quot;)
    &#039;Select the target folder
    objExpl.SelectFolder personalFolder.Folders(&quot;Deleted Items&quot;)
    &#039;Get the Empty Deleted Items command = UID 1671
    Set objCBB = objExpl.CommandBars.FindControl(, 1671)
    &#039;Execute the command
    objCBB.Execute
    
    &#039;***Empty Personal Folders Deleted Items Folder
    &#039;Change the current folder to the target personal folder / pst name
    Set personalFolder = mNameSpace.Folders(&quot;2 - non PES Email&quot;)     &#039;Family is the name of the Personal Folder
    Set objExpl.CurrentFolder = personalFolder.Folders(&quot;Deleted Items&quot;)
    &#039;Select the target folder
    objExpl.SelectFolder personalFolder.Folders(&quot;Deleted Items&quot;)
    &#039;Get the Empty Deleted Items command = UID 1671
    Set objCBB = objExpl.CommandBars.FindControl(, 1671)
    &#039;Execute the command
    objCBB.Execute
        
    &#039;Return to the original folder
    Set objExpl.CurrentFolder = mNameSpace.GetFolderFromID(strEntryID, strStoreID)
    
ExitHere:
    On Error Resume Next
    Set objCBB = Nothing
    Set objExpl = Nothing
    Set mNameSpace = Nothing
    Set objOutlookApp = Nothing
    Set personalFolder = Nothing
    Exit Sub
ErrorHandler:
    Resume ExitHere
End Sub
=================================================
Is there something else I should look at to determine why this is suddenly not working?
Also, one time when I ran it, it MOVED a folder into the main Deleted Items folder without deleting it. I did NOT want the folder moved or deleted.
Thanks.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve been using this code for several months, but now it is only deleting from the main Deleted Items folder.<br />
Here is the code with my other folder names inserted as you instructed:</p>
<p>Sub EmptyDeletedItems()<br />
    &#8216;Empties the default Mailbox Deleted Items Folder along with<br />
    &#8216;the Deleted Items folder in multiple Personal Folders / PSTs<br />
    &#8216; 11/11/11 -dg- found this on <a href="http://sabarish.net/blog/archives/437" rel="nofollow">http://sabarish.net/blog/archives/437</a></p>
<p>    On Error GoTo ErrorHandler</p>
<p>    Dim objOutlookApp As Outlook.Application<br />
    Dim mNameSpace As NameSpace<br />
    Dim objExpl As Outlook.Explorer<br />
    Dim objCBB As CommandBarButton<br />
    Dim strEntryID As String<br />
    Dim strStoreID As String</p>
<p>    Set objOutlookApp = CreateObject(&#8220;Outlook.Application&#8221;)<br />
    Set mNameSpace = objOutlookApp.GetNamespace(&#8220;MAPI&#8221;)<br />
    &#8216;Set the explorer to the active explorer<br />
    Set objExpl = objOutlookApp.ActiveExplorer<br />
    &#8216;Capture the original current folder Entry and Store ID&#8217;s<br />
    strEntryID = objExpl.CurrentFolder.EntryID<br />
    strStoreID = objExpl.CurrentFolder.StoreID</p>
<p>    &#8216;***Empty Main Deleted Items Folder<br />
    &#8216;Change the current folder to the target folder<br />
    Set objExpl.CurrentFolder = mNameSpace.GetDefaultFolder(olFolderDeletedItems)<br />
    &#8216;Select the target folder<br />
    objExpl.SelectFolder mNameSpace.GetDefaultFolder(olFolderDeletedItems)<br />
    &#8216;Get the Empty Deleted Items command = UID 1671<br />
    Set objCBB = objExpl.CommandBars.FindControl(, 1671)<br />
    &#8216;Execute the command<br />
    objCBB.Execute</p>
<p>    &#8216;***Empty Personal Folders Deleted Items Folder<br />
    &#8216;***Copy this section as many times as there are the number of<br />
    &#8216;***different personal folders. -dg<br />
    &#8216;Change the current folder to the target personal folder / pst name<br />
    Set personalFolder = mNameSpace.Folders(&#8220;1 &#8211; PES Email&#8221;)    &#8216;Friends is the name of the Personal Folder<br />
    Set objExpl.CurrentFolder = personalFolder.Folders(&#8220;Deleted Items&#8221;)<br />
    &#8216;Select the target folder<br />
    objExpl.SelectFolder personalFolder.Folders(&#8220;Deleted Items&#8221;)<br />
    &#8216;Get the Empty Deleted Items command = UID 1671<br />
    Set objCBB = objExpl.CommandBars.FindControl(, 1671)<br />
    &#8216;Execute the command<br />
    objCBB.Execute</p>
<p>    &#8216;***Empty Personal Folders Deleted Items Folder<br />
    &#8216;Change the current folder to the target personal folder / pst name<br />
    Set personalFolder = mNameSpace.Folders(&#8220;2 &#8211; non PES Email&#8221;)     &#8216;Family is the name of the Personal Folder<br />
    Set objExpl.CurrentFolder = personalFolder.Folders(&#8220;Deleted Items&#8221;)<br />
    &#8216;Select the target folder<br />
    objExpl.SelectFolder personalFolder.Folders(&#8220;Deleted Items&#8221;)<br />
    &#8216;Get the Empty Deleted Items command = UID 1671<br />
    Set objCBB = objExpl.CommandBars.FindControl(, 1671)<br />
    &#8216;Execute the command<br />
    objCBB.Execute</p>
<p>    &#8216;Return to the original folder<br />
    Set objExpl.CurrentFolder = mNameSpace.GetFolderFromID(strEntryID, strStoreID)</p>
<p>ExitHere:<br />
    On Error Resume Next<br />
    Set objCBB = Nothing<br />
    Set objExpl = Nothing<br />
    Set mNameSpace = Nothing<br />
    Set objOutlookApp = Nothing<br />
    Set personalFolder = Nothing<br />
    Exit Sub<br />
ErrorHandler:<br />
    Resume ExitHere<br />
End Sub<br />
=================================================<br />
Is there something else I should look at to determine why this is suddenly not working?<br />
Also, one time when I ran it, it MOVED a folder into the main Deleted Items folder without deleting it. I did NOT want the folder moved or deleted.<br />
Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Empty all Deleted Items Folders at the same time</title>
		<link>http://sabarish.net/blog/archives/437/comment-page-1#comment-45061</link>
		<dc:creator>Empty all Deleted Items Folders at the same time</dc:creator>
		<pubDate>Fri, 05 Aug 2011 11:41:47 +0000</pubDate>
		<guid isPermaLink="false">http://sabarish.net/?p=437#comment-45061</guid>
		<description>[...] Yet ]Sabarish Raghupathy runs a personal blog but one of his articles has some Outlook VBA code to empty the Deleted Items folders for multiple mailboxes. Visit the article for the full code.The code works well but requires some hardcoding of mailbox [...]</description>
		<content:encoded><![CDATA[<p>[...] Yet ]Sabarish Raghupathy runs a personal blog but one of his articles has some Outlook VBA code to empty the Deleted Items folders for multiple mailboxes. Visit the article for the full code.The code works well but requires some hardcoding of mailbox [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jay</title>
		<link>http://sabarish.net/blog/archives/437/comment-page-1#comment-19894</link>
		<dc:creator>Jay</dc:creator>
		<pubDate>Sun, 07 Feb 2010 01:13:37 +0000</pubDate>
		<guid isPermaLink="false">http://sabarish.net/?p=437#comment-19894</guid>
		<description>Nevermind, I found it in the Outlook Program.

Tools&gt;Options&gt;Other&gt;Advanced Options&gt;

Uncheck &quot;Warn before permenantly deleting items.&quot;

Best</description>
		<content:encoded><![CDATA[<p>Nevermind, I found it in the Outlook Program.</p>
<p>Tools&gt;Options&gt;Other&gt;Advanced Options&gt;</p>
<p>Uncheck &#8220;Warn before permenantly deleting items.&#8221;</p>
<p>Best</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jay</title>
		<link>http://sabarish.net/blog/archives/437/comment-page-1#comment-19893</link>
		<dc:creator>Jay</dc:creator>
		<pubDate>Sun, 07 Feb 2010 01:10:42 +0000</pubDate>
		<guid isPermaLink="false">http://sabarish.net/?p=437#comment-19893</guid>
		<description>I am using your code, but I get the message pop-up asking if I am sure I want to delete the items.  How do I get rid of that pop-up and just have the items deleted?</description>
		<content:encoded><![CDATA[<p>I am using your code, but I get the message pop-up asking if I am sure I want to delete the items.  How do I get rid of that pop-up and just have the items deleted?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sabarishr</title>
		<link>http://sabarish.net/blog/archives/437/comment-page-1#comment-18642</link>
		<dc:creator>sabarishr</dc:creator>
		<pubDate>Wed, 23 Sep 2009 15:37:38 +0000</pubDate>
		<guid isPermaLink="false">http://sabarish.net/?p=437#comment-18642</guid>
		<description>Hey Searcher! 

Thanks for bringing that to my notice! I had actually uploaded the wrong code. For representational purposes I had copied and pasted that repeating section from the main deleted items folder and forgot to change the values. I&#039;ve uploaded the new version now. 

You don&#039;t need to loop through all files - you can do a select all (ID 756) and delete (ID 478) directly.

Cheers,
Sab</description>
		<content:encoded><![CDATA[<p>Hey Searcher! </p>
<p>Thanks for bringing that to my notice! I had actually uploaded the wrong code. For representational purposes I had copied and pasted that repeating section from the main deleted items folder and forgot to change the values. I&#8217;ve uploaded the new version now. </p>
<p>You don&#8217;t need to loop through all files &#8211; you can do a select all (ID 756) and delete (ID 478) directly.</p>
<p>Cheers,<br />
Sab</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Searcher</title>
		<link>http://sabarish.net/blog/archives/437/comment-page-1#comment-18641</link>
		<dc:creator>Searcher</dc:creator>
		<pubDate>Wed, 23 Sep 2009 14:48:16 +0000</pubDate>
		<guid isPermaLink="false">http://sabarish.net/?p=437#comment-18641</guid>
		<description>Hi,

I came across your article when I decided to create separate PST files for each email account and realized there isn&#039;t a logical way to remove deleted emails. Thanks to your code I managed to deal with the problem quite quickly.. 

but I&#039;m wondering if you actually tested your code and it was working for you?

You are calling UID 1671 which is the main Empty &quot;Deleted Items&quot; Folder and as such it&#039;s emptying only the default account, no matter if you selected another one.

So the solution is to enter the respective deleted items folder, loop through it and remove all items.

I thought I&#039;d let you know ;)

-src-</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I came across your article when I decided to create separate PST files for each email account and realized there isn&#8217;t a logical way to remove deleted emails. Thanks to your code I managed to deal with the problem quite quickly.. </p>
<p>but I&#8217;m wondering if you actually tested your code and it was working for you?</p>
<p>You are calling UID 1671 which is the main Empty &#8220;Deleted Items&#8221; Folder and as such it&#8217;s emptying only the default account, no matter if you selected another one.</p>
<p>So the solution is to enter the respective deleted items folder, loop through it and remove all items.</p>
<p>I thought I&#8217;d let you know ;)</p>
<p>-src-</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Automatically empty 2 or more &#34;Deleted Items&#34; folders - Page 2 &#124; keyongtech</title>
		<link>http://sabarish.net/blog/archives/437/comment-page-1#comment-15663</link>
		<dc:creator>Automatically empty 2 or more &#34;Deleted Items&#34; folders - Page 2 &#124; keyongtech</dc:creator>
		<pubDate>Sun, 18 Jan 2009 16:53:51 +0000</pubDate>
		<guid isPermaLink="false">http://sabarish.net/?p=437#comment-15663</guid>
		<description>[...] that links to that macro.  I&#039;ve uploaded the macro along with instructions on how to use it here - http://sabarish.net/blog/archives/437  Do let me know if that solves your problem.  Cheers, Sabarish  &quot;Tyler G.&quot; wrote:  &gt; I [...]</description>
		<content:encoded><![CDATA[<p>[...] that links to that macro.  I&#8217;ve uploaded the macro along with instructions on how to use it here &#8211; <a href="http://sabarish.net/blog/archives/437" rel="nofollow">http://sabarish.net/blog/archives/437</a>  Do let me know if that solves your problem.  Cheers, Sabarish  &quot;Tyler G.&quot; wrote:  &gt; I [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

