[VBA ]Timer問題
各位大大好
小的在網路上看到一VBA Timer的應用
ub Schedule()
DoEvents
If Sheet2.Cells(2, 1) = 1 Then '當這個欄位值為1的時候開始紀錄
Call record '把DDE值抓到EXCEL的副程式
Call timer_Start 'timer開始
End If
End Sub
Sub timer_Start() '開始timer 每秒call Schedule一次
Application.OnTime Now + TimeValue("00:00:01"), "Schedule", Schedule:=True
End Sub
Sub timer_Stop()
On Error Resume Next '停止timer
Application.OnTime Now + TimeValue("00:00:01"), "Schedule", Schedule:=False
End Sub
Sub record() '紀錄DDE資料的副程式
Sheet2.Cells(2, 2) = Sheet2.Cells(2, 2) + 1 '這欄用來記錄現在行數
Sheet2.Cells(Sheet2.Cells(2, 2), 3) = Sheet1.Cells(1, 1)
'假設DDE要記錄的值在 Sheet1的(1,1)這個欄位
'將這資料存在 Sheet2中
End Sub
於是就把它貼去VBA的編議器上,我並沒有添加任何FORM或物件
他告訴我找不到巨集
想請問一下小的是出哪的錯
因為小弟無任何VBA經驗,很久以前有碰過VB
想請問一下各位大大可否給予指導.
或是給小的一些簡單的概念,謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 210.243.104.61
→
10/21 00:25, , 1F
10/21 00:25, 1F
推
10/22 12:37, , 2F
10/22 12:37, 2F