Bonjour,

J'ai pas mal cherché avant de venir ici et testé beaucoup de possibilité pour obtenir le texte contenu dans une option d'un combobox mais rien à faire, quoi que je fasse j'obtiens une valeur = ""...

Le code utilisé.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
objIE.Document.Body.InnerHTML = "<div align=""center""><p>" & myPrompt _
										& "</p><p><form name=""liste_form"" id=""Liste_form""></p>" _
										& "<p><select name=""List"" id=""List"">" _
										& "<option value=""Opt1"">bla</option>" _
										& "<option value=""Opt2"">blo</option>" _
										& "<option value=""Opt3"">bli</option>" _
										& "<option value=""Opt4"">blu</option>" _
										& "<option value=""Opt5"">ble</option>" _
										& "<option value=""Opt6"">bly</option>" _
										& "</select></p>" _
										& "<input type=""hidden"" id=""OK"" name=""OK"" value=""0"">" _
										& "<p><input type=""submit"" value="" OK "" " _
										& "onclick=""VBScript:OK.Value=1""> " _
										& "<input type=""submit"" value="" Annuler "" " _
										& "onclick=""VBScript:OK.Value=2""></p>" _
										& "</form></div>"
 
		' Hide the scrollbars
		objIE.Document.Body.Style.overflow = "auto"
		' Make the window visible
		objIE.Visible = True
 
		objIE.Document.All.List.Focus
 
		On Error Resume Next
		Do While objIE.Document.All.OK.Value = 0
			WScript.Sleep 200
			' Error handling code by Denis St-Pierre
			If Err Then    'user clicked red X (or alt-F4) to close IE window
				IELogin = Array( "", "" )
				objIE.Quit
				Set objIE = Nothing
				Exit Function
			End if
		Loop
		On Error Goto 0
 
		For Each opt In objIE.Document.getElementById("List").options
			If opt.selected Then
				GetValue = opt.text	
			End If
		Next
Si vous avez des idées,

Merci.