2014-03-04 36 views
0

我想添加一段代碼,在代碼添加到搜索表單後自動按Enter鍵。如何點擊輸入觸發搜索

的URL是以下之一: http://www.nook.com/gb/store/books

到目前爲止我的代碼(因爲我沒有看到在搜索框代碼它不工作..)

Selection.Copy

IE.Document.getElementByid(「_ skeyword」).Value = ActiveCell.Value

我是非常新的編碼,所以任何幫助將不勝感激!

在此先感謝你們!

回答

0

當我們點擊輸入它只是通過導航到URL獲取請求。嘗試下面的代碼。

Sub SearchBook() 

    Dim URL As String 
    URL = "http://www.nook.com/gb/store/books" 

    Dim bookname As String 
    bookname = "visions trips and crowded rooms" 


    Dim IE As Object 
    Set IE = CreateObject("InternetExplorer.Application") 
    IE.navigate URL 
    IE.Visible = True 


    Application.Wait Now + TimeSerial(0, 0, 5) 
    MsgBox "Site will now search for book" 

    IE.navigate "http://www.nook.com/gb/search?utf8=%E2%9C%93&%5Bs%5Dkeyword=" & bookname 

End Sub 
+0

嗨Santosh,謝謝你回到我這裏。我試圖做的是以下幾點:昏暗的IE作爲對象 昏暗X作爲整數 設置IE =的CreateObject( 「InternetExplorer.Application」) IE.Navigate「http://www.nook.com/gb /存儲/書籍」 IE.Visible =真 apiShowWindow IE.hwnd,SW_MAXIMIZE 雖然IE.busy 的DoEvents 蜿蜒 – user3376057

+0

「建立 」for「 循環循環 」numRows行「 的次數。 「在這裏它進入我的excel文件和拍攝代碼(ISBN) 對於x = 1至numRows行 」從活動單元格選擇單元向下行1。 Selection.Copy IE.Document.getElementByid( 「_ skeyword 」)。價值= ActiveCell.Value Application.SendKeys 「〜」 Application.Wait(現在+ TIMEVALUE(「 00:00:01」)) – user3376057

+0

基本上我需要將ISBN放入搜索字段並自動觸發Enter命令,以便我可以進入書的頁面。提前感謝您的耐心和時間! – user3376057