I'm looking for a way to implement keywords inside the body message.
The algorithm will read the body message and add the keywords inside the same body message.
Read > Extract the keywords by using the RemoveStopWords Function > Write the keywords inside the message body.
Keywords: Sales, Invoice, etc.
I have one file containing some StopWords as mentioned, a function called RemoveStopWords.
Steps of my algorithm
1-Triggered by a custom button
2-Read the body message and store it in some variable
3-Read the file that has the StopWords ("C:\Users\Juliano\Documents\ListOfStopWords.txt")
4-Store the stopwords (step 3) in some variant variable
5-Remove the stopwords from the body message that are stored in some variable (step 2)
6-Store the Keywords in some variable (KeyWord as variant)
7- Update the variable that stored the body message (step 2) including the Keywords (step 6)
The algorithm will read the body message and add the keywords inside the same body message.
Read > Extract the keywords by using the RemoveStopWords Function > Write the keywords inside the message body.
Keywords: Sales, Invoice, etc.
I have one file containing some StopWords as mentioned, a function called RemoveStopWords.
Steps of my algorithm
1-Triggered by a custom button
2-Read the body message and store it in some variable
3-Read the file that has the StopWords ("C:\Users\Juliano\Documents\ListOfStopWords.txt")
4-Store the stopwords (step 3) in some variant variable
5-Remove the stopwords from the body message that are stored in some variable (step 2)
6-Store the Keywords in some variable (KeyWord as variant)
7- Update the variable that stored the body message (step 2) including the Keywords (step 6)
Code:
Public Function RemoveStopWords( _
ByVal Phrase As String, _
ByVal WordToRemove As String _
) As String
Dim RetVal As String
Dim Tmp As String
'remove the word in the middle of the phrase
RetVal = Replace(Phrase, " " & WordToRemove & " ", " ")
'remove the word at the beginning
Tmp = WordToRemove & " "
If Left(RetVal, Len(Tmp)) = Tmp Then
RetVal = Mid(RetVal, Len(Tmp) + 1)
End If
'remove the word at the end
Tmp = " " & WordToRemove
If Right(RetVal, Len(Tmp)) = Tmp Then
RetVal = Left(RetVal, Len(RetVal) - Len(Tmp))
End If
RemoveStopWords = RetVal
End Function