GetNumberOfEventLogRecords Method

Gets the number of records in the specified event log.


  obj.GetNumberOfEventLogRecords(EventLogName string, NumRecords variant, [MachineName string])
  where obj is an OpScrUtil.EventLog object 


EventLogName Specifies the name of the log file from which to retrieve number of records.
NumRecords Number of records in the specified event log.
MachineName Specifies the target computer. This parameter is optional. If not specified or an empty string, the local computer is the target.

Return Type



To get the number of records from a System log file, enter:

  Set obj = CreateObject("OpScrUtil.EventLog")
  bOK = obj.GetNumberOfEventLogRecords("System", n)
If bOK <> 0 Then
  MsgBox "The number of records in the eventlog is " & n
  MsgBox obj.GetError()
end if   

This example shows how to get number of records in an event log.