用vb怎样提取自己加入的所有QQ群的号码?
我的一个QQ号加入了许多个qq群。我想把这些群号码都提取出来,保存成一个文本文件,一行一个号码。怎样用vb实现呢?...
我的一个QQ号加入了许多个qq群。我想把这些群号码都提取出来,保存成一个文本文件,一行一个号码。怎样用vb实现呢?
展开
1个回答
展开全部
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
Dim s As String
s = WebBrowser1.Document.body.innerhtml
If InStr(s, "我加入的群") = 0 Then Exit Sub
Dim FilePath As String, fnum As Integer
FilePath="D:\QQqun.txt"
fnum=FreeFile
Open FilePath for Output As #fnum
Dim p As Long, q As Long
q = 1
Do
q = InStr(q, s, "rel=jump jQuery")
If q = 0 Then Exit Do
p = InStrRev(s, "#", q) + 1
Print #fnum, Trim(Mid(s, p, q - p)) & ":";
p = InStr(q, s, ">") + 1
q = InStr(p, s, "<")
Print #fnum, Mid(s, p, q - p)
Loop
Close #fnum
s=""
End Sub
Dim s As String
s = WebBrowser1.Document.body.innerhtml
If InStr(s, "我加入的群") = 0 Then Exit Sub
Dim FilePath As String, fnum As Integer
FilePath="D:\QQqun.txt"
fnum=FreeFile
Open FilePath for Output As #fnum
Dim p As Long, q As Long
q = 1
Do
q = InStr(q, s, "rel=jump jQuery")
If q = 0 Then Exit Do
p = InStrRev(s, "#", q) + 1
Print #fnum, Trim(Mid(s, p, q - p)) & ":";
p = InStr(q, s, ">") + 1
q = InStr(p, s, "<")
Print #fnum, Mid(s, p, q - p)
Loop
Close #fnum
s=""
End Sub
更多追问追答
追问
保存到QQqun.txt,不要后面的名称,只要前面的号码,一行一个号码。可以吗?
追答
修改部分代码如下:
With List1
If .ListCount > 0 Then
Print #fnum, "我加入的群:"
For i = 0 To .ListCount - 1
Print #fnum, Mid(.List(i), InStr(.List(i), ":") + 1, InStrRev(.List(i), ":") - InStr(.List(i), ":") - 1) ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Next i
End If
End With
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询