求TextBox1 字体自动大小适应相应的框里. 如extBox1 有十几个字符的也有现三个字符的. 网摘宏如下:
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long) Dim arrRM, F
'输入名单到: TextBox1 采用单个空格分隔,最前和最后一个数据后不要留空格(否则可能部分元素抽出为空) '代码注释部分用于调试,或者你可以修改为其他用途,比如可以显示给用户观看。 Private Sub CommandButton1_Click() If Me.CommandButton1.Caption = "停" Then Me.CommandButton1.Caption = "开始" Call CQ_do("stop") Else Me.CommandButton1.Caption = "停" Call CQ_do("start") End If End Sub
Private Sub CQ_do(doTag) Dim I If doTag = "start" Then arrRM = Split(Me.TextBox1, " ", -1, 1) '如果有需要你可以替换这里的空格,改为你需要的分隔符: 如个为英文分号 Split(Me.TextBox1, ";", -1, 1) ' TextBox3 = "" ' TextBox3.Visible = True ' TextBox4.Visible = True ' Me.TextBox4 = UBound(arrRM) & " " & arrRM(0) & " " & arrRM(UBound(arrRM)) F = 0 Do While True Sleep 30 I = Int(((UBound(arrRM) + 1) * Rnd) + 0) ' TextBox3 = TextBox3 & "-" & I TextBox2.Text = arrRM(I) If F = 1 Then Exit Do DoEvents Loop Else F = 1 End If End Sub
Private Sub TextBox1_Change()
End Sub
Private Sub TextBox2_Change()
End Sub
|