我在一个幻灯片里设计了一个按钮,有一些VBA代码,可是为什么总是执行不了,偶尔却又可以执行,为什么?请教各位大侠怎样才能让它每次都执行?代码如下: 另:我已将安全级别设置成了低 Private Sub CommandButton1_Click() c = "" x = "法此注作院数型选童图习障屏组电施尊题校勒美" y = TextBox1.Value z = 0 k = 0 t = ""
For i = 1 To Len(TextBox1.Value) If Mid(x, i, 1) <> Mid(y, i, 1) Then c = c + Mid(x, i, 1) k = k + 1 t = t + "X" Else t = t + "√" End If Next z = ((Len(TextBox1.Value) - k) / Len(TextBox1.Value)) * 100 Label1.Caption = "您输入了" + Str(Len(TextBox1.Value)) + "个字符,对" + Str(Len(TextBox1.Value) - k) + "个,错" + Str(k) + "个,正确率:" + LTrim(Left(Str(z), 5)) + "%。错字:" Label2.Caption = c Label3.Caption = t Label1.Visible = True Label2.Visible = True Label3.Visible = True End Sub
|