devxlogo

February 26, 2000

ReplaceWord – Replace whole words

‘ Replace a whole wordFunction ReplaceWord(Source As String, Find As String, ReplaceStr As String, _ Optional ByVal Start As Long = 1, Optional Count As Long = -1, _ Optional

InstrWord – Search a whole word

‘ Return the next occurrence of a whole wordFunction InstrWord(start, Text, search, compareMethod) As Long Dim index As Long Dim charcode As Integer ‘ assume the search fails InstrWord =

Soundex – Determine the phonetic code of a word

‘ The Soundex code of an alphabetical string” you can use Soundex code for phonetic searches’ Beware: this isn’t bullet-proof!” UPDATE: this version corrects a bug in the original routine’

Drop the Parentheses in a VBScript Sub

Beginners are sometimes stymied when they get error messages on code that works perfectly elsewhere. For example, this code produces the error message, “Cannot use parentheses when calling a Sub”: