Jacob Lemming
New Member
- Joined
- Jan 29, 2015
- Messages
- 5
I’m trying to select a value on the html dropdown box with excel vba code (as far as I know the html is javascript) but I’m not good at html.
I have tried every possible proposal from various forums, without luck.
The web page is an internal company page, so unfortunately it cannot be shared.
The dropdown box is Tagname ("select"), I can enter a value with sendkey, but it is not selected.
When the right value is selected there are several dropboxes that changing options depending on the value.
someone who has an idea?
I got this:
I have tried every possible proposal from various forums, without luck.
The web page is an internal company page, so unfortunately it cannot be shared.
The dropdown box is Tagname ("select"), I can enter a value with sendkey, but it is not selected.
When the right value is selected there are several dropboxes that changing options depending on the value.
someone who has an idea?
I got this:
Code:
Set IE = New InternetExplorerMedium
IE.Visible = True
URL =”xxx”
For Each htmlInput In IE.document.all
While IE.Busy Or IE.readyState < 4: DoEvents: Wend
Select Case htmlInput.ID
Case Country:
Call WriteHtmlInput(htmlInput, "43.")
….
Sub WriteHtmlInput(htmlInput As MSHTML.HTMLInputElement, txt As String)
Dim TimeWaitShort As String
Dim TimeWaitLong As String
TimeWaitShort = "0:00:02"
TimeWaitLong = "0:00:04"
Debug.Print "Tagname: " & htmlInput.tagName & " Tekst: " & txt & " ID: " & htmlInput.ID
Select Case htmlInput.tagName
Case "INPUT": ' f.eks title
htmlInput.Focus
Application.Wait (Now + TimeValue(TimeWaitShort))
htmlInput.Value = txt
Case "DIV
Application.Wait (Now + TimeValue(TimeWaitLong))
htmlInput.textcontent = txt
Case "SELECT": 'f.eks dropdown
htmlInput.Focus
?????
Application.Wait (Now + TimeValue(TimeWaitLong))
Case Else
Debug.Print "Æv der er sket en fejl"
End Select
End Sub
Last edited by a moderator: