View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Ron Rosenfeld[_2_] Ron Rosenfeld[_2_] is offline
external usenet poster
 
Posts: 1,045
Default Count tokens in a string

On Wed, 25 May 2011 14:06:23 -0700, "Robert Crandal" wrote:

"Rick Rothstein" wrote in message
...

However, if you cannot be sure of this...

TokenCount = 1 + UBound(Split(WorksheetFunction.Trim(myVar)))


Hi Rick. This is a good solution. However, do you know if this code
can be transfered to MS Word VBA as well?? I'm not sure if
Word VBA uses the "WorksheetFunction" reference or not.

thnx


Word does not support the WorksheetFunction. However, you could set a reference to Excel (Tools/References Microsoft Excel 12.0 Object Library)