str = "my name is pankaj"
words= Split(str," ")
MsgBox UBound(words)+1
words= Split(str," ")
MsgBox UBound(words)+1
'In case If you have to count the number of word in Notepad then you can use the following approch .
Set np = CreateObject("scripting.filesystemobject")
Set onp = np.OpenTextFile("C:\Documents and Settings\sharmapa\Desktop\Blog.txt",1)
str = onp.ReadAll
words= Split(str," ")
MsgBox UBound(words)+1
Set onp = np.OpenTextFile("C:\Documents and Settings\sharmapa\Desktop\Blog.txt",1)
str = onp.ReadAll
words= Split(str," ")
MsgBox UBound(words)+1
No comments:
Post a Comment