[dba-Tech] Need for Timer event in Word

Dan Waters dwaters at usinternet.com
Fri Nov 21 10:52:04 CST 2008


Hi Susan,


This is a class module for timing events (named clsStopWatch):
---------------------------------------------------------------
Private MlngStart As Long
Private Declare Function GetTickCount Lib "kernel32" () As Long

Public Sub StartTimer()

    MlngStart = GetTickCount
    
End Sub

Public Function EndTimer() As Long

    EndTimer = (GetTickCount - MlngStart)
    
End Function
---------------------------------------------------------------


This is how it's used in a procedure:
---------------------------------------------------------------
Private MstwStopWatch As clsStopWatch

Private Sub RecordDeltaMilliseconds(stgStartStop As String, stgTestName As
String)

    Dim stg As String
    
    Select Case stgStartStop
        Case "Start"
        
            Set MstwStopWatch = New clsStopWatch
            MstwStopWatch.StartTimer
             
        Case "Stop"
        
            stg = "INSERT INTO tblTimingData ( TestName, MilliSeconds )" _
                & " VALUES ('" & stgTestName & "', " &
MstwStopWatch.EndTimer & ")"
            DoCmd.SetWarnings False
            DoCmd.RunSQL stg
            DoCmd.SetWarnings True

    End Select
 
End Sub
---------------------------------------------------------------

Good Luck!
Dan

PS - This came from the VBA Developer's Handbook


-----Original Message-----
Subject: [dba-Tech] Need for Timer event in Word

I've been asked to provide a generic function in Word that will play a 
specific sound at intervals. Initially I thought, no big deal, but I was 
thinking in Access terms. Word has no Timer event, so I'm wondering now how 
to approach this problem. Any ideas?

Susan H. 

_______________________________________________
dba-Tech mailing list
dba-Tech at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/dba-tech
Website: http://www.databaseadvisors.com




More information about the dba-Tech mailing list