Hi all,

How to get name and value of the form in HTML file using HTML dom. Please help me how to get fname, lname in the file.

I have tried the below code its not working.

Function HTML_Access()
Set objHTML = CreateObject("Microsoft.XMLHTTP")
URL = "file.hmtl"
objHTML.Open "Get", URL, False
objHTML.Send ""
MsgBox "ready state" & objHTML.readyState
MsgBox "Print text" & objHTML.responseText

Set val_x = objHTML.document.getElementById("frm1")
For i = 0 To val_x.Lenght - 1
End Function

Sample html file
HTML file:

<p>Hello World!</p>
<p>The DOM is very useful!</p>

<form id="frm1" action="form_action.asp">
First name: <input type="text" name="fname" value="Donald" /><br />
Last name: <input type="text" name="lname" value="Duck" /><br />
<input type="submit" value="Submit" />