用程序自动给下面的内容中赋值.
http://hi.baidu.com/微迈互联/boardeg:
'----------------------
Option ExplicitPrivate Sub Command1_Click()
'这里给内容中赋值
End SubPrivate Sub Form_Load()
Me.WebBrowser1.Navigate ("hi.baidu.com/微迈互联/board")
End Sub

解决方案 »

  1.   

    WebBrowser1结合MShtml就很好实现了
      

  2.   

    Dim i As Integer
        For i = 0 To WebBrowser1.Document.All.Length - 1
            If UCase(WebBrowser1.Document.All(i).tagName) = "INPUT" Then
                Select Case WebBrowser1.Document.All(i).Name
                    Case "q"
                        WebBrowser1.Document.All(i).Value = "haha韓"
                End Select
            End If
        Next
      

  3.   

    Dim docHtml As mshtml.HTMLDocument
                Dim Element As mshtml.IHTMLElement
                docHtml = WebBrowser1.Document
                Element = docHtml.getElementById("tagname")
                If Not Element Is Nothing Then
                    Element.setAttribute("value", "UserName")
                Else
                    Exit Function
                End If你这样试一试。
      

  4.   

    谢谢两楼上两位大虾,这样是不行的。如果那是一个普通TEXT那就很容易了,但事实上没那么简单。请大虾们用实际环境测试一下。单独还有200分。
      

  5.   

    Option ExplicitPrivate Sub Command1_Click()
        Dim oDoc As HTMLDocument
        Dim oInput As HTMLInputTextElement
        Dim oCell As HTMLTableCell
        
        Set oDoc = WebBrowser1.Document
        
        Set oInput = oDoc.getElementsByTagName("INPUT").Item(3)
        oInput.Value = "Hello"
        Set oInput = Nothing
        
        Set oInput = oDoc.getElementsByTagName("INPUT").Item(4)
        oInput.Value = "World"
        Set oInput = Nothing
        
       Set oCell = oDoc.getElementsByTagName("TD").Item(12)
       oCell.innerHTML = "Good" & oCell.innerHTML
       Set oCell = Nothing
        
        Set oInput = oDoc.getElementsByTagName("INPUT").Item(6)
        oInput.Value = "Night"
        Set oInput = Nothing
        
        Set oDoc = Nothing
    End SubPrivate Sub Form_Load()
        WebBrowser1.Navigate ("http://hi.baidu.com/微迈互联/board")
    End Sub
      

  6.   

    to:Hassle Set oCell = oDoc.getElementsByTagName("TD").Item(12) 
       oCell.innerHTML = "Good" & oCell.innerHTML 
       Set oCell = Nothing 我用的就是这句,但就这句不行,表面上看起来是写上去了,但是提交不了。请再帮忙看一下,谢谢了
      

  7.   

    下面两贴各是200分,是同一问题,解决了全部送
    http://topic.csdn.net/u/20080310/17/b0504a99-6bcf-414d-86c6-bd6fc9dba3df.html
    http://topic.csdn.net/u/20080311/12/76f9ec64-9a8f-4c90-a160-a1e97eaf315d.html
      

  8.   


    Private Sub Command1_Click()  
    '这里给内容中赋值  
    Dim webdoc As HTMLDocument
    Dim Form As HTMLFormElement
    Set webdoc = WebBrowser1.Document
    Set Form = webdoc.Forms(0)
    With Form
    .Item("spBCmtAuthor").Value = "hn123 " '姓名
    .Item("spBCmtURL").Value = "www.vicmiao.com" '网址或邮箱
    .Item("spBCmtText").Value ="200分贴" '内容
    .Item("spVerifyKey").Value ="无法识别" '验证码
    '.submit '提交
    End With
    End Sub 
      

  9.   

    to: eslbs 谢谢关注,但你的方法不行。
    .Item("spBCmtText").Value ="200分贴" '内容
    这句不起做用。