Back

Topic

[KB657]How to use the AITimer in VBA

Tags: Scripting, Timer, VBA

12 years ago
By NK
Options
Print
Applies to:

PcVue version 8.0 onwards.


Summary:

How to use the AITimer, provided with PcVue, in VBA.


Details:

PcVue provides a component library called Arc Informatique Common Controls. So far this library contains only 1 ActiveX: AITimer. You should use this component when you need a permanent timer instead of the previous one that had to be inserted in a mimic. How to use it?

  1. Add the AI Common Control library in VBA. Tools / References / Arc Informatique Common Controls 1.0
  2. Use the following code. Example: Use a permanent timer triggering every 1s

Dim WithEvents oTimer As AIComCtl.Timer     ‘Declare the timer object

Private Sub fvProject_StartupComplete()

     Set oTimer = New AIComCtl.Timer     ‘Add a new Timer instance
     oTimer.Interval = 1000     ‘Timer interval is in ms. Here 1s
     oTimer.Enabled = True     ‘You can start/stop the timer at any time by setting Enabled property

End Sub

‘Called every Timer.Interval
Private Sub oTimer_Timer()

     Debug.Print Now

End Sub


Created on: 12 Jul 2013 Last update: 13 May 2024