Quote Originally Posted by malik641
I would love to see that code
Code snippet for Parsing Event Logs is below. I did want to mention that the code to parse the Yahoo RSS is generic to any RSS feed (that follow the RSS specification) so you can get financial information, blogs etc..

As for the event log code, you will note I hard-coded the timegenerated variable to June 1, 2007 - you would probably want to offer the user an input to choose 7,14,30 days back from the current date and perform the math and string conversion. Note the OpenXML() method is a 2003 feature. Also, if the event data is quite extensive you can go the extra stp and create a Pivot Table from the xml data.

[vba]
Sub eventlog()
'event log file error types
'//////////////////////////////////////////////////////////////////////////////////////
'Error=2 An error event. This indicates a significant problem the user should
' know about' usually a loss of functionality or data.
'
'FailureAudit=4 A failure audit event. This indicates a security event that occurs when
' an audited access attempt fails' for example, a failed attempt to open a file.
'
'Information=0 An information event. This indicates a significant, successful operation.
'
'SuccessAudit=3 A success audit event. This indicates a security event that occurs when
' an audited access attempt is successful' for example, logging on successfully.
'
'Warning=1 A warning event. This indicates a problem that is not immediately significant,
' but that may signify conditions that could cause future problems.
'//////////////////////////////////////////////////////////////////////////////////////
Dim cXML As String
cXML = ActiveWorkbook.Path & "\events.xml"
If Dir(cXML) <> "" Then Kill (cXML)
'Event log dates take this format
Dim thedate As String
thedate = "2007-06-01 00:00:00"
cSQL = "SELECT timegenerated, timewritten, computername, eventid, eventtypename, "
cSQL = cSQL & "eventcategory, eventcategoryname, sourcename, SID, Resolve_SID(SID), "
cSQL = cSQL & "message, strings, data INTO " & cXML & " FROM System,Security WHERE "
cSQL = cSQL & "eventtype IN (1;2) AND timegenerated > '" & thedate & "' "
cSQL = cSQL & "ORDER BY timegenerated"
MsgBox cSQL
Set oLog = CreateObject("MSUtil.LogQuery")
oLog.maxParseErrors = 100
Set oInput = CreateObject("MSUtil.LogQuery.EventLogInputFormat")
Set oOut = CreateObject("MSUtil.LogQuery.XMLOutputFormat.1")
oLog.ExecuteBatch cSQL, oInput, oOut
If oLog.lastError <> 0 Then
cErrors = "Errors:" & vbCrLf
For Each strMessage In oLog.errorMessages
cErrors = cErrors & strMessage & vbCrLf
Next
MsgBox cErrors
End If

If Dir(cXML) <> "" Then
'this is a 2003 feature
Application.Workbooks.OpenXML Filename:=cXML, LoadOption:=xlXmlLoadImportToList
Else
MsgBox "No Events found Events XML Not Created"
End If
End Sub
[/vba]

Stan