HTML转表格

Sub ht(Html, Range)
s1 = Split(Html, " rn = UBound(s1)
cn = UBound(Split(s1(2), ""))
ReDim arr(rn - 1, cn - 1)
For ri = 1 To rn
s2 = Split(s1(ri), " If UBound(s2) = 0 Then s2 = Split(s1(ri), " For ci = 1 To cn
arr(ri - 1, ci - 1) = smid(s2(ci), ">", "<")
Next
Next
Range.Resize(rn, cn) = arr
End Sub

Function smid(a, b, c) '截取首次出现文本中间
If InStr(a, b) > 0 Then
smid = Right(a, Len(a) - InStr(a, b) - Len(b) + 1)
If InStr(smid, c) > 0 Then
smid = Left(smid, InStr(smid, c) - 1)
End If
End If
End Function

你可能感兴趣的:(HTML转表格)