Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 通过VBA更改Amazon ComboBox_Html_Vba_Excel - Fatal编程技术网

Html 通过VBA更改Amazon ComboBox

Html 通过VBA更改Amazon ComboBox,html,vba,excel,Html,Vba,Excel,我试着写一个VBA宏,它使我在InternetExplorer中的工作自动化。我的目标是捕捉已经打开的亚马逊网页,并利用“书籍”下拉菜单的价值。 目前我能够抓到运行亚马逊网站,但我不知道如何更改下拉菜单的值 Sub amazonCheck() Dim element As Object Dim i As Integer 'get opened Amazon session Dim shellWins As ShellWindows Dim IE As InternetExplorer S

我试着写一个VBA宏,它使我在InternetExplorer中的工作自动化。我的目标是捕捉已经打开的亚马逊网页,并利用“书籍”下拉菜单的价值。 目前我能够抓到运行亚马逊网站,但我不知道如何更改下拉菜单的值

Sub amazonCheck()

Dim element As Object
Dim i As Integer


'get opened Amazon session
Dim shellWins As ShellWindows
Dim IE As InternetExplorer

Set shellWins = New ShellWindows
i = shellWins.Count

On Error Resume Next
For i = 0 To i
    If shellWins.Item(i).Parent = "Internet Explorer" Then
        Debug.Print shellWins.Item(i).Document.URL
        shellWins.Item(i).Visible = True

        If shellWins.Item(i).Document.URL = "http://www.amazon.com/" Then
            Set IE = shellWins.Item(i)
            Exit For
        End If
    End If
Next i
On Error GoTo 0


'try to get dropdown box/ I think it is working fine,
Set element = IE.Document.getElementByID("searchDropdownBox").Item(0)

'try to change a value of dropdown box/ It does nothing
element.Value = "Books"
End Sub
在这里,您可以看到一个Amazon HTML代码示例(我不知道HTML是否可能,因为我在错误的代码部分搜索)


各部门
亚马逊视频
器具
应用程序及;游戏
工艺美术,;缝纫
汽车
宝贝
美女
书
光碟及;乙烯基
.
.
.
我不知道HTML,它可能很容易或不可能做到。
您有什么建议吗?

更改元素的值是件小事。更新屏幕以反映变化是否至关重要是另一回事

'try to get dropdown box/ I think it is working fine,
Set element = IE.Document.getElementByID("searchDropdownBox")   '.Item(0) <~~ do not need this on the end

'try to change a value of dropdown box/ It does nothing
element.selectedIndex = 4  'set to Arts, Crafts and Sewing
element.Value = "search-alias=stripbooks"   'set to Books
“尝试使用下拉框/我认为它工作正常,

设置element=IE.Document.getElementByID(“searchDropdownBox”)。项(0)可能
element.Value=“search alias=stripbooks”
Hi,不幸的是,它也不起任何作用。(也没有返回错误)好,现在是锯-它正在工作,只是没有在屏幕上刷新。很抱歉,非常感谢你!我只是在写一封回复信来说明同样的情况。
'try to get dropdown box/ I think it is working fine,
Set element = IE.Document.getElementByID("searchDropdownBox")   '.Item(0) <~~ do not need this on the end

'try to change a value of dropdown box/ It does nothing
element.selectedIndex = 4  'set to Arts, Crafts and Sewing
element.Value = "search-alias=stripbooks"   'set to Books