Excel clawer2

Sub testData()
Dim array2() As String
Dim rowNum As Long
'Set objs1 = Sheets("ORGFCST")
Dim keywords As String
Dim ff As Long

rowNum = Sheets("Sheet1").Range("a65536").End(xlUp).Row
array2() = getCompanyList()
For ff = 0 To rowNum Step 1
If array2()(ff) <> "" Then
keywordsGeneral = clawResult(CStr(array2()(ff)), "aaa", ff)
End If
Next
Shell ("taskkill /f /im IEXPLORE.exe")
End Sub

Function getCompanyList() As String()
Dim d, a, c As Variant
Dim strT
Dim strs As String
Dim array1(100) As String
Set d = CreateObject("Scripting.Dictionary")
For i = 2 To Sheets("Sheet1").Range("a65536").End(xlUp).Row Step 1
'strT = GetChs(CStr(Sheets("Sheet1").Cells(i, 2)))
strT = CStr(Sheets("Sheet1").Cells(i, 1))
If strT <> "" Then
array1(i - 2) = strT
End If
Next


getCompanyList = array1()


End Function


Function clawResult(link As String, companyName As String, companyLine As Long) As String
Dim ie, dmt, tb, i&, j&, a&, strxP As String, strsH As String, strsA As String, strsResult As String

Set ie2 = CreateObject("InternetExplorer.Application")
With ie2
.Visible = False
.navigate link

Do Until .ReadyState = 4 Or .busy = False
DoEvents
Loop

Set dmt2 = .document
If TypeName(dmt2) <> "AcroPDF" Then
Set contentsP = dmt2.all.tags("p")
For i1 = 0 To contentsP.Length - 1
'strs2 = strs2 & vbCrLf & contentsP.Item(i1).innertext
strsResult = strsResult + contentContains(CStr(contentsP.Item(i1).innertext))
Next

Set contentsH = dmt2.all.tags("h3")
For i2 = 0 To contentsH.Length - 1
strsResult = strsResult + contentContains(CStr(contentsH.Item(i2).innertext))
Next

Set contentsA = dmt2.all.tags("a")
For i3 = 0 To contentsA.Length - 1
strsResult = strsResult + contentContains(CStr(contentsA.Item(i3).innertext))
Next

Cells(companyLine + 2, 4) = link
Cells(companyLine + 2, 3) = strsResult + "OVER"
End If
End With



clawResult = ""


End Function

Function contentContains(content As String) As String
Dim d, a, c As Variant
Dim strT
Dim strs As String
Dim array1(100) As String
Set d = CreateObject("Scripting.Dictionary")
For i = 2 To Sheets("Sheet1").Range("b65536").End(xlUp).Row Step 1
'strT = GetChs(CStr(Sheets("Sheet1").Cells(i, 2)))
strT = CStr(Sheets("Sheet1").Cells(i, 2))
If InStr(content, strT) Then
strs = strs & vbCrLf & "| " + strT + " : " + content + " |"
End If
Next

contentContains = strs
End Function
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值