PDA

View Full Version : input text in to htm page using vba from excel



s.dinah
09-17-2015, 06:44 AM
Hi,

I am having some problem putting some text form excel into 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 reached the If Instr part:
Method 'document' of object 'IWebBrower2' failed

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

Can anyone please help

Thanks,

Sherzaad