Ninaa Logs
Views:
Ninaa keeps a record of internet access for one month. This data must be manually exported to T:\techfiles\Documentation\internet log\ for future reference.
The log data on Ninaa is made available as a csv spreadsheet per day going back one month from the current date. The csv's are downloaded and imported in to an Excel Workbook to make sorting and searching easier.
At the moment we are using one spreadsheet per year, excel seems to just about cope with it.
To help speed up the process the following macro can be used:
Sub import_logs()
'
' Copyright Kieran Whitbread 2005
' import_logs Macro
' Keyboard Shortcut: Ctrl+w
'
internetLogFileName = Application.ActiveWorkbook.Name
setting = Application.ShowWindowsInTaskbar
Application.ShowWindowsInTaskbar = False
MyPath = "T:\techfiles\Documentation\Internet Log\ninaa_landing_pad\"
currentLog = Dir(MyPath, vbDirectory)
Do While currentLog <> ""
If currentLog <> "." And currentLog <> ".." Then
curSheetCount = ActiveWorkbook.Sheets.Count
Workbooks.OpenText Filename:= _
MyPath + currentLog, _
Origin:=xlMSDOS, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, _
Comma:=True, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 1), _
Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1)), TrailingMinusNumbers:=True
curSheet = currentLog
Sheets(curSheet).Move After:=Workbooks(internetLogFileName).Sheets(curSheetCount)
Columns("A:A").ColumnWidth = 26.57
Columns("C:C").ColumnWidth = 13.14
Columns("E:E").ColumnWidth = 13.86
Range("A1:E50000").Sort Key1:=Range("E2"), Order1:=xlAscending, Key2:= _
Range("D2"), Order2:=xlDescending, Header:=xlGuess, OrderCustom:=1, _
MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal, _
DataOption2:=xlSortNormal
Columns("A:E").Select
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
Range("A1").Select
Kill MyPath + currentLog
End If
currentLog = Dir
Loop
Application.ShowWindowsInTaskbar = setting
End Sub
Download the csv files to T:\techfiles\Documentation\internet log\ninaa_landing_pad\ then run the macro to have the csv files automatically imported, formatted and sorted. (you might want to rearrange the worksheet tabs to put them in date order :-)
