PDA

View Full Version : HELP: input text into htm page textbox using vba from excel



s.dinah
09-20-2015, 02:51 AM
Hi,

I am having some problem putting some text form excel into a textbox in a htm file located on my PC. Please see my code below:

Sub open_manureq()
Dim IE As Object
Dim wd As Object


'On Error Resume Next


Set IE = CreateObject("InternetExplorer.Application")


IE.navigate "C:\Program Files (x86)\DDT2000\tool_manualsend.htm"


For Each wd In CreateObject("Shell.Application").Windows
If wd = "Windows Internet Explorer" Then
If InStr(LCase(wd.document.Title), "manual") <> 0 Then
Do While wd.Busy
DoEvents
Loop
wd.document.all("text1").Value = Sheet1.Range("A9").Value
Exit For
End If
End If
Next wd


End Sub

I keep getting the following error message when it reaches the line in red:
Method 'document' of object 'IWebBrower2' failed

I have added "Microsoft HTML Object Library" and "Microsoft Internet Controls" vba references but I'm still getting the same error message.

Can anyone please help

Thanks,