取得网页中特定的链接 Private Sub Command1_Click() WebBrowser1.Navigate "http://www.95557.com/svote.htm" End Sub
Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant) Dim a
For Each a In WebBrowser1.Document.All If a.tagname = "A" Then If a.href = "http://tech.sina.com.cn/mobile/capture.shtml" Then a.Click End If End If Next End Sub
Option Explicit Private m_bDone As Boolean
Private Sub Command1_Click() If m_bDone Then Dim doc As IHTMLDocument2 Set doc = WebBrowser1.Document Dim aLink As HTMLLinkElement Set aLink = doc.links(0) aLink.Click End If End Sub
Private Sub Form_Load() WebBrowser1.Navigate "http://www.95557.com/svote.htm" End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant) m_bDone = True End Sub
The following code can be used to query and delete files in the internet cache (including cookies). A demonstration routine can be found at the bottom of this post. Note, the enumerated type eCacheType is not supported in Excel 97, but can be changed to a list of Public Constants eg. Public Const eNormal = &H1&. Option Explicit '--------------------------Types, consts and structures Private Const ERROR_CACHE_FIND_FAIL As Long = 0 Private Const ERROR_CACHE_FIND_SUCCESS As Long = 1 Private Const ERROR_FILE_NOT_FOUND As Long = 2 Private Const ERROR_ACCESS_DENIED As Long = 5 Private Const ERROR_INSUFFICIENT_BUFFER As Long = 122 Private Const MAX_CACHE_ENTRY_INFO_SIZE As Long = 4096 Private Const LMEM_FIXED As Long = &H0 Private Const LMEM_ZEROINIT As Long = &H40 Public Enum eCacheType