In the click event of the button that you want to count words, place something like this:

VB Code:
  1. MsgBox CountWords(myTextbox.text) & " words in document"

or to place them in a variable,
VB Code:
  1. dim x as integer
  2. x = CountWords(myTextbox.text)
  3. msgbox("There are " & x & " words in this document")