Private WithEvents s As TimerPrivate Sub Class_Initialize() s.Interval = 100 s.Enabled = True End SubPrivate Sub s_Timer() Debug.Print Now End Sub 这样也会出现错误,是不是类模块中不能使用其他组件哦?!
上面的是class1中的下面的代码是form1中的 Dim n As Class1Private Sub Form_Load() Set n = New Class1 End Sub
s.Interval = 100
s.Enabled = True
End SubPrivate Sub s_Timer()
Debug.Print Now
End Sub
这样也会出现错误,是不是类模块中不能使用其他组件哦?!
Dim n As Class1Private Sub Form_Load()
Set n = New Class1
End Sub