'====================================================
' Колонка Result возвращает "Номер SIM-карты"
'====================================================
Dim FSO
Set FSO = CreateObject("Scripting.FileSystemObject")
Const ForReading = 1
Const ReadingLine = 61
On Error Resume Next
Select Case LCase(FSO.GetExtensionName(filename))
Case "html"
content = FromHtml(filename)
Case "xml"
content = FromXml (filename)
Case "xls"
content = FromXls (filename)
Case Else
content = ""
End Select
If Err.Number <> 0 Then content = ""
On Error GoTo 0
Set FSO = Nothing
Function FromHtml(pFile)
Dim i
FromHtml = ""
With FSO.OpenTextFile(pFile, ForReading)
i = 1
Do While Not .AtEndOfStream
If i < ReadingLine Then
.SkipLine
i = i + 1
Else
FromHtml = Mid(.ReadLine, 24, 20)
Exit Do
End If
Loop
.Close
End With
End Function
Function FromXml(pFile)
FromXml = ""
'Задача пока не формализована
' With FSO.OpenTextFile(pFile, ForReading)
' Do While Not .AtEndOfStream
' .SkipLine
' Loop
' .Close
' End With
End Function
Function FromXls(pFile)
FromXls = ""
With CreateObject("Excel.Application")
.Workbooks.Open pFile, null, True
On Error Resume Next
FromXls = .Cells(5,3).Value
On Error GoTo 0
.Quit
End With
End Function
|