PC Review


Reply
Thread Tools Rate Thread

Adding feedback to a textbox as items are deleted

 
 
steven.shannon@gmail.com
Guest
Posts: n/a
 
      11th Jun 2005
I have created a module that will go through and delete all of the
items in a specified outlook folder. I'm attempting to modify it so
that as the items are being deleted, the status of this process is
updated incrementally in a feedback texbox for the user to view (very
similar Sue Mosher's example program 9.5 in her "Microsoft Outlook
Programming" book). However, each time I run it, it displays the
feedback for the last time I ran it only and not the one currently
running -- almost as if it's caching all of the information from the
previous trial somewhere and displaying it the next time I try and run
it.

In other words, if I ran it yesterday and deleted 300 items in some
folder, and then ran it again today but tried deleting 150 items in a
completely different folder, the feedback displayed is for the deletion
of the 300 items yesterday.

The way I'm doing it: first I run a module that loads and shows the
Progress form that contains the textbox. Then I call DeleteAllEntries
that deletes all the entries in the folder whose path is stored in a
class module. DeleteAllEntries makes calls to UpdateProgress which
handles pushing the timestamp to the textbox in the Progress form.

Here is my code for DeleteAllEntries and UpdateProgress. Please note
that the UpdateProgress sub lives in the code for the Progress form:
_______________________________________________

'Delete all entries in the specified folder
Sub DeleteAllEntries()
Dim objFolder As Outlook.MAPIFolder
Dim numCount As Integer
Dim numDeleted As Integer
Set objFolder = GetFolder(InstPrefs.GetFolderPath)
numCount = objFolder.Items.Count
Progress.UpdateProgress ("Processing " & numCount & " items for
deletion")
For i = objFolder.Items.Count To 1 Step -1
If objFolder.Items.Count Mod 50 = 0 Then
numDeleted = numCount - objFolder.Items.Count
Progress.UpdateProgress ("Deleted " & numDeleted & " of " &
numCount)
End If
objFolder.Items.Item(i).Delete
Next
Progress.UpdateProgress ("Finished deleting " & numCount & " items
from folder")
Set objFolder = Nothing
End Sub
_________________________________________________

'Append timestamp and given text to the progress window
Public Sub UpdateProgress(strUpdate As String)
TextBox1.Value = FormatDateTime(Now, vbShortTime) & vbTab &
strUpdate & Chr(13) & Progress.TextBox1.Value
DoEvents
Me.Repaint
End Sub
__________________________________________________

Hope this makes sense. Any help would be appreciated because I'm
drowning here. Thanks very much in advance.

-Steve Shannon
Lux Scientiae, Inc.

 
Reply With Quote
 
 
 
 
Michael Bauer
Guest
Posts: n/a
 
      12th Jun 2005
Hi Steve,

> completely different folder, the feedback displayed is for the

deletion
> of the 300 items yesterday.


how do you mean that?

For the first call your UpdateProgress shows the folderīs Items.Count
and the current *time* in short. Where do you know from that itīs the
time of yesterday?

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I have created a module that will go through and delete all of the
> items in a specified outlook folder. I'm attempting to modify it so
> that as the items are being deleted, the status of this process is
> updated incrementally in a feedback texbox for the user to view (very
> similar Sue Mosher's example program 9.5 in her "Microsoft Outlook
> Programming" book). However, each time I run it, it displays the
> feedback for the last time I ran it only and not the one currently
> running -- almost as if it's caching all of the information from the
> previous trial somewhere and displaying it the next time I try and run
> it.
>
> In other words, if I ran it yesterday and deleted 300 items in some
> folder, and then ran it again today but tried deleting 150 items in a
> completely different folder, the feedback displayed is for the

deletion
> of the 300 items yesterday.
>
> The way I'm doing it: first I run a module that loads and shows the
> Progress form that contains the textbox. Then I call DeleteAllEntries
> that deletes all the entries in the folder whose path is stored in a
> class module. DeleteAllEntries makes calls to UpdateProgress which
> handles pushing the timestamp to the textbox in the Progress form.
>
> Here is my code for DeleteAllEntries and UpdateProgress. Please note
> that the UpdateProgress sub lives in the code for the Progress form:
> _______________________________________________
>
> 'Delete all entries in the specified folder
> Sub DeleteAllEntries()
> Dim objFolder As Outlook.MAPIFolder
> Dim numCount As Integer
> Dim numDeleted As Integer
> Set objFolder = GetFolder(InstPrefs.GetFolderPath)
> numCount = objFolder.Items.Count
> Progress.UpdateProgress ("Processing " & numCount & " items for
> deletion")
> For i = objFolder.Items.Count To 1 Step -1
> If objFolder.Items.Count Mod 50 = 0 Then
> numDeleted = numCount - objFolder.Items.Count
> Progress.UpdateProgress ("Deleted " & numDeleted & " of "

&
> numCount)
> End If
> objFolder.Items.Item(i).Delete
> Next
> Progress.UpdateProgress ("Finished deleting " & numCount & " items
> from folder")
> Set objFolder = Nothing
> End Sub
> _________________________________________________
>
> 'Append timestamp and given text to the progress window
> Public Sub UpdateProgress(strUpdate As String)
> TextBox1.Value = FormatDateTime(Now, vbShortTime) & vbTab &
> strUpdate & Chr(13) & Progress.TextBox1.Value
> DoEvents
> Me.Repaint
> End Sub
> __________________________________________________
>
> Hope this makes sense. Any help would be appreciated because I'm
> drowning here. Thanks very much in advance.
>
> -Steve Shannon
> Lux Scientiae, Inc.
>


 
Reply With Quote
 
steven.shannon@gmail.com
Guest
Posts: n/a
 
      13th Jun 2005
Hey Michael,

Apologies, that was more just an example to try to explain what's going
on. The same thing happens if I do two runs a few hours or a few
minutes apart. The information that is printed is that pertaining to
the first run (as evidenced by the timestamps and the counts that is
displayed).

-Steve

 
Reply With Quote
 
Michael Bauer
Guest
Posts: n/a
 
      13th Jun 2005
Hi Steve,

Now() returns the current date & time as shown in your Systray. If you
get a different time somewhere printed then there is something wrong
with your code. I donīt know how to help you with a sample that you
arenīt using at all.

--
Viele Gruesse / Best regards
Michael Bauer - MVP Outlook


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hey Michael,
>
> Apologies, that was more just an example to try to explain what's

going
> on. The same thing happens if I do two runs a few hours or a few
> minutes apart. The information that is printed is that pertaining to
> the first run (as evidenced by the timestamps and the counts that is
> displayed).
>
> -Steve
>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding items from Listbox to empty textbox Corey .... Microsoft Excel Programming 2 30th Jan 2009 02:38 AM
IMAP- automatically move deleted items to deleted items folder =?Utf-8?B?Y2RiYW5kZXJzb24=?= Microsoft Outlook Discussion 0 8th Nov 2005 08:02 PM
deleted emails from 'deleted items' are not in recovered deleted items option JohnL Microsoft Outlook Discussion 0 11th Jan 2005 05:46 PM
Outlook error: "Some of the items in 'Deleted Items' folder could not be deleted jack schols Windows XP Internet Explorer 2 14th Mar 2004 01:40 AM
adding a deleted date field to Deleted items folder Frank Microsoft Outlook Discussion 4 28th Aug 2003 04:15 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:20 AM.