废话不多说,上代码
Module1
Public TC, TS As String Function RunCode(ByVal ThisCode As String) TmpCode = LCase(ThisCode) a = InStr(TmpCode, "printl ") If a = 1 Then TC = "ot" TS = Mid(ThisCode, 8) End If a = InStr(TmpCode, "ifobox ") If a = 1 Then MsgBox Mid(ThisCode, 8) End If End Function
Form1
Private Sub Timer1_Timer() If TC = "ot" Then Text1.Text = Text1.Text + TS + vbCrLf TS = "" TC = "" End If End Sub
调用时:
RunCode(要执行的代码)