<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: VBA Function To Calculate Number of Words in a String</title>
	<atom:link href="http://www.automateexcel.com/2008/09/20/vba-function-to-calculate-number-of-words-in-a-string/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.automateexcel.com/2008/09/20/vba-function-to-calculate-number-of-words-in-a-string/</link>
	<description>Everything Excel. Only Excel.</description>
	<lastBuildDate>Mon, 21 Nov 2011 07:25:47 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
	<item>
		<title>By: Jon Peltier</title>
		<link>http://www.automateexcel.com/2008/09/20/vba-function-to-calculate-number-of-words-in-a-string/comment-page-1/#comment-873</link>
		<dc:creator>Jon Peltier</dc:creator>
		<pubDate>Sat, 20 Sep 2008 13:01:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.automateexcel.com/?p=891#comment-873</guid>
		<description>An alternative, especially if you want to do something with the words, is something like the function below, which returns the number of words and an array containing these words:

Function CountWords(sInput As String, iWords As Long, vWords As Variant) As Boolean
  vWords = Split(sInput, &quot; &quot;)
  iWords = UBound(vWords) + 1 - LBound(vWords)
  CountWords = True
End Function

Sub TestCountWords()
  Dim sSentence As String
  Dim iCount As Long
  Dim vSplit As Variant
  Dim bTest As Boolean
  sSentence = InputBox(&quot;Type a sentence&quot;)
  bTest = CountWords(sSentence, iCount, vSplit)
  MsgBox sSentence &amp; vbNewLine &amp; vbNewLine &amp; &quot;has &quot; &amp; iCount &amp; &quot; words.&quot;
End Sub</description>
		<content:encoded><![CDATA[<p>An alternative, especially if you want to do something with the words, is something like the function below, which returns the number of words and an array containing these words:</p>
<p>Function CountWords(sInput As String, iWords As Long, vWords As Variant) As Boolean<br />
  vWords = Split(sInput, &#8221; &#8220;)<br />
  iWords = UBound(vWords) + 1 &#8211; LBound(vWords)<br />
  CountWords = True<br />
End Function</p>
<p>Sub TestCountWords()<br />
  Dim sSentence As String<br />
  Dim iCount As Long<br />
  Dim vSplit As Variant<br />
  Dim bTest As Boolean<br />
  sSentence = InputBox(&#8220;Type a sentence&#8221;)<br />
  bTest = CountWords(sSentence, iCount, vSplit)<br />
  MsgBox sSentence &amp; vbNewLine &amp; vbNewLine &amp; &#8220;has &#8221; &amp; iCount &amp; &#8221; words.&#8221;<br />
End Sub</p>
]]></content:encoded>
	</item>
</channel>
</rss>

