S
steven.shannon
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.
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.