Dim s As String
Dim i As Long
Dim count As Long
s = Text1.Text
'如果不区分大小写加上这句
's = LCase$(s)
For i = 1 To Len(s)
If Mid$(s, i, 1) = "p" Then count = count + 1
Next i
Print count
给你个我刚写的函数,调用方式会吧。Str参数为要统计的字符串
Function TjChr(Str As String) As Integer
Dim i As Integer, sum As Integer
For i = 1 To Len(Str)
If Mid(Str, i, 1) = "p" Then sum = sum + 1
Next i
TjChr = sum
End Function