Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

適用對象

Form 物件

您可以使用 TimerInterval 屬性指定表單上 Timer 事件之間的時間間隔 (毫秒)。 讀/寫長整數

expression.TimerInterval

運算式 必要。 傳回 [套用至] 清單中其中一個對象的表達式。

備註

TimerInterval 屬性設定是一個介於 0 到 2,147,483,647 之間的長整數值。

您可以使用表單的屬性工作表、巨集或 Visual Basic for Applications (VBA) 程式碼來設定此屬性。

附註: 使用 VBA 時,您可以在表單的 Load 事件中設定 TimerInterval 屬性。

若要在 TimerInterval 屬性指定的時間間隔執行 VBA 程式碼,請將該程式碼放置在表單的 Timer 事件程序中。 例如,若要每隔 30 秒重新查詢記錄,請將程式碼放置在表單的 Timer 事件程序中,以重新查詢記錄,然後再將 TimerInterval 屬性設為 30000。

範例

下列範例示範如何顯示和隱藏按鈕的圖示,以便在表單上建立閃爍按鈕。 表單的 Load 事件程序會將表單的 TimerInterval 屬性設為 1000,因此圖示顯示會每秒切換一次。

Sub Form_Load()
Me.TimerInterval = 1000
End Sub
Sub Form_Timer()
Static intShowPicture As Integer
If intShowPicture Then
' Show icon.
Me!btnPicture.Picture = "C:\Icons\Flash.ico"
Else
' Don't show icon.
Me!btnPicture.Picture = ""
End If
intShowPicture = Not intShowPicture
End Sub

Need more help?

Want more options?

探索訂閱權益、瀏覽訓練課程、瞭解如何保護您的裝置等等。

社群可協助您詢問並回答問題、提供意見反應,以及聆聽來自具有豐富知識的專家意見。

Was this information helpful?

How satisfied are you with the translation quality?
What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×