Microsoft Office Tutorials and References
In Depth Information
The StrComp function compares two strings and returns:
n 0 if the two strings are the same.
n –1 if the first string is less than (before alphabetically) the second string.
n 1 if the first string is more than (after alphabetically) the second string.
The vbTextCompare argument tells StrComp() to ignore the case of letters. Other options are
explained in the VBA documentation.
There are lots of other criteria you can use to move or process messages, such as receipt date,
sender name, whether the message has been read, and so on. Table 24.3 described the various
message properties that may be useful when processing messages.
Using the Application
There’s one more element needed to complete this application. You cannot run MoveMessages
BySubject() directly. You need a macro that can be run from the Macros dialog box and also
lets the user enter the required information — subject text to search for and destination folder
name. This is accomplished by the macro MoveFolder() , shown in Listing 25.2.
LISTING 25.2
The MoveMessages () Macro
Public Sub MoveMessages()
Dim Subject As String, DestinationFolder As String
Dim result As Boolean
Do
Subject = InputBox(“Enter the subject text to look for”, _
“Move Folders By Subject”)
Loop Until Len(Subject) > 0
Do
DestinationFolder = InputBox(“Enter the name of the destination folder”, _
“Move Folders By Subject”)
Loop Until Len(DestinationFolder) > 0
result = MoveMessagesBySubject(Subject, DestinationFolder)
If result Then
MsgBox “Messages moved successfully”
Else
MsgBox “An unknown error occurred”
End If
End Sub
Search JabSto ::




Custom Search