http://www.lecai.com/lottery/draw&

144
提问者
2023-03-15 23:58 悬赏 0财富值 阅读 855回答 1

自己加个计时器定时刷新Option ExplicitPrivate Sub Command1_Click() Dim ul As String, mark

默认分类
登录 后发表回答
1楼 · 2023-03-16 00:48.采纳回答

'自己加个计时器定时刷新
Option Explicit
Private Sub Command1_Click()
Dim ul As String, mark As String, s As String, temp As String
ul = "http://www.lecai.com/lottery/draw/view/200?phase=20130312072&agentId=5555"
Command1.Enabled = False
With CreateObject("InternetExplorer.Application")
.Visible = False
.navigate ul
Do Until .readyState = 4
DoEvents
Loop
s = .document.body.innerhtml
End With
mark = "latest_draw_time = "
If InStr(s, mark) = 0 Then
Command1.Enabled = True
Exit Sub
End If
temp = Mid(s, InStr(s, mark) + Len(mark) + 1, 20) & vbNewLine
mark = "var phaseData = {""" & Format(Date, "yyyy-mm-dd") & """:"
s = Mid(s, InStr(s, mark) + Len(mark), Len(s))
mark = """red"""
s = Mid(s, InStr(s, mark) + Len(mark) + 2, 19)
temp = temp & s
MsgBox temp
Command1.Enabled = True
End Sub更多追问追答追问

多实验几次出现错误提示

    • 我开始时在win7运行正常的,多实验几次突然发现这个错误。追答
      你可以先建立一个对象,然后在最后把这个对象注销掉再试试,set obj=nothing,我是直接创建然后完成任务后消失,可能不同系统结果不一样,你自己测试一下。