2.然後打開excel,按照妳自己的要求建立窗體,然後在工具欄上點右鍵-“附加控件”-找到剛剛裝的VBAtimer控件然後在窗體任意地方畫壹個timer控件。
3.然後在新建的窗體上右鍵-“查看代碼”,並輸入以下代碼:
Private Sub CommandButton1_Click()
UserForm1.Label1.Font.Bold = True
UserForm1.Label1.Font.Italic = True
Timer1.Interval = 500
Timer1.Enabled = True
End Sub
Sub timer1_timer()
Dim a As Long, b As Long, c As Long
Randomize
a = Int(256 * Rnd )
b = Int(256 * Rnd )
c = Int(256 * Rnd )
UserForm1.Label1.ForeColor = RGB(a, b, c)
End Sub
Private Sub CommandButton2_Click()
UserForm1.Label1.Font.Bold = False
UserForm1.Label1.Font.Italic = False
Timer1.Enabled = False
End Sub
4.最後在在工程管理窗口上雙擊Thisworkbook,在彈出的代碼框輸入以下代碼:
Private Sub Workbook_Open()
UserForm1.Show
End Sub
5.附:如果2、3、4步不知道做的話,做完第壹步然後把郵箱留給我。