Dim objTable as Object
Set objTable = .Document.frames(1).frames(2).Document.getElementsByTagName("TABLE")
With Combo1
For i = 0 To objSelect(1).Options.length - 1
.AddItem objSelect(1).Options(i).innerText
Next
(ここの処理)
End With
HTML上のコンボボックスからVB上のコンボボックスにデータを取得し、そのListIndexを指定したいのですが、わかりません。
> Dim objTable as Object
> Set objTable = .Document.frames(1).frames(2).Document.getElementsByTagName("TABLE")
objTableを利用している部分が書かれていないようですが…。
> For i = 0 To objSelect(1).Options.length - 1
変数 objSelect というのは、SELECTエレメントの事でしょうか?
> そのListIndexを指定したいのですが
VBのComboBoxコントロールでは、選択項目をListIndexプロパティで指定しますが、
HTMLの単一選択SELECTエレメントでは、選択項目をselectedIndexプロパティで指定します。
Dim objSelect as Object
Set objSelect = .Document.frames(1).frames(2).Document.getElementsByTagName("SELECT")
With Combo1
For i = 0 To objSelect(1).Options.length - 1
.AddItem objSelect(1).Options(i).innerText
Next
★objSelect(1).SelectedIndex
End With
★で解決しました。ありがとうございます!
以前解決させてもらったスレッドに上乗せしています。
<select multiple>
とコンボボックスのチェックボックスタイプで処理をしたいのですが、
Set objSelect = WebBrowser.Document.getElementsByTagName("SELECT")
objSelect(0).SelectedIndex = Combo.ListIndex(他にMultiSelect、いずれもエラーはでませんが、動作しません。)
自分なりにはobjSelect(0).SelectedIndexのSelectedIndexプロパティが違うと思うのですが、他のプロパティがあるのでしょうか?
SELECT要素のselectedIndexプロパティ … 選択された先頭項目を示します
http://www.microsoft.com/japan/developer/library/jpisdk/dhtml/references/properties/selectedIndex.htm
OPTION要素のselectedプロパティ … その項目が選択されているかを示します。
http://www.microsoft.com/japan/developer/library/jpisdk/dhtml/references/properties/selected.htm#selected