]
Option Explicit
Dim FSO
Function doWork(Data,Index)
Dim strIn
strIn = CStr(Data)
Set FSO = CreateObject("Scripting.FileSystemObject")
Dim Ext
Ext = GetAnExtension(strIn)
If LCase(Ext) <> "xls" Then
Sys.onEvent strIn
Else
Dim XL
Set XL = CreateObject("Excel.Application")
XL.WorkBooks.Open strIn
Dim strOut
strOut = ""
Dim rows
rows = 2
Dim colm
colm = 1
Do While Not IsEmpty(XL.Cells(rows, 1).Value)
Do While Not IsEmpty(XL.Cells(rows, colm).Value)
strOut = strOut & XL.Cells(rows, colm).Value & ";"
colm = colm + 2
Loop
strOut = strOut & vbCrLf
colm = 1
rows = rows + 1
Loop
XL.Quit
Set XL = Nothing
Sys.onExcel strOut
End If
End Function
Function GetAnExtension(FileSpec)
On Error Resume Next
GetAnExtension = FSO.GetExtensionName(FileSpec)
If CStr(Err.Number) <> 0 Then call LogMsg(EventError, "Can't get extension of file: " & FileSpec)
End Function
Sub LogMsg(intType, strMsg)
Sys.onError strMsg & ";" & intType
End Sub