|
-
Apr 28th, 2005, 09:19 PM
#11
Thread Starter
Member
Re: Searching string array
hi rob,
okay i've got another idea...which may work as im not sure my other one did - and i actually even tried to code it myself well kind of but im getting an error, basically now im just trying to pass it off as a function and then call it from the main command...but im getting a compile error "expected function or call"? maybe im calling it wrong from the CommandButton1_Click() function????????
Private Sub CommandButton1_Click()
Dim myText As String
Dim countComma As Integer
Dim countFullstop As Integer
myText = Selection.Text
countComma = findChar(myText, ",")
countFullstop = findChar(myText, ".")
MsgBox "No. of comma's is: " & countComma
MsgBox "No. of fullstop's is: " & countFullstop
End Sub
Private Sub findChar(Text As String, myChar As String)
Dim counter As Integer
Dim iPos As Integer
'Text = Selection.Text
counter = 0
iPos = 0
iPos = InStr(1, Text, myChar)
Do While iPos > 0
iPos = InStr(iPos, Text, myChar)
If iPos > 0 Then iPos = iPos + 1
counter = counter + 1
Loop
counter = counter - 1
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|