Autofill IE form based on Excel data

Drwats0n

New Member
Joined
Dec 10, 2015
Messages
46
Hi Guys, i googled and managed to find this simple code. However, i encountered error message " Run-time error '438' : Object doesnt support this property or method". I have tried both Byname and ByID but was returned with the same error code.

Below is my vba code. i have masked the web link to xxx.

Sub FillInternetForm()
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
IE.Navigate "xxx"
IE.Visible = True
While IE.Busy
DoEvents
Wend
IE.Document.getElementByName("Domain.Instrument").Value = ThisWorkbook.Sheets("sheet1").Range("a1")
End Sub

And below infor from the web page

[TABLE="width: 1790"]
<colgroup><col></colgroup><tbody>[TR]
[TD]<label for="Domain_Instrument"><a tabindex="-1" class="app-link" href="xxx" data-bind="href: { url: 'xxx', observe: [editingItem.instrument], keys: ['edit'] }">Instrument</a></label>[/TD]
[/TR]
[TR]
[TD]<input name="Domain.Instrument" id="Domain_Instrument" type="text" value="" autocomplete="off" data-bind="filterValue: editingItem.instrument, fieldMeta: editingItem.instrument, filter: 'xxx', optionsText: '__key__', restrictToList: 'The field Instrument has an invalid selection.'" data-lookup-display-name="Instrument" data-prefix="editingItem">[/TD]
[/TR]
</tbody>[/TABLE]

Thanks for the guidance..
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Can you paste the script for that object from the IE browser?

Really unhelpful if there's no URL...
 
Last edited:
Upvote 0
Sorry i can't post the URL as its password protected. The below is the web page information i trying to post in my original post.

[TABLE="width: 1790"]
<colgroup><col></colgroup><tbody>[TR]
[TD]label for="Domain_Instrument"a tabindex="-1" class="app-link" href="xxx" data-bind="href: { url: 'xxx', observe: [editingItem.instrument], keys: ['edit'] }"Instrument[/TD]
[/TR]
[TR]
[TD]input name="Domain.Instrument" id="Domain_Instrument" type="text" value="" autocomplete="off" data-bind="filterValue: editingItem.instrument, fieldMeta: editingItem.instrument, filter: 'xxx', optionsText: '__key__', restrictToList: 'The field Instrument has an invalid selection.'" data-lookup-display-name="Instrument" data-prefix="editingItem"[/TD]
[/TR]
</tbody>[/TABLE]
 
Last edited:
Upvote 0
Can you paste the script for that object from the IE browser?

Really unhelpful if there's no URL...

Hi so sorry, can't paste the url here as its password protected. I have posted bit of the script below and i hope it helps
Do let me know what else is helpful and i will paste it here.

Thankss
 
Upvote 0
Looks like a pretty standard input, can't see where the issue would lie from the info given. I'd use a near identical:

Code:
Sub IEnav()


    Dim IE As Object
     
Set IE = CreateObject("InternetExplorer.Application")


    With IE
        .Visible = True
        .navigate "www.google.com.au"
    While .Busy Or .ReadyState <> 4: DoEvents: Wend


        Set dominst = IE.Document.getElementById("Domain_Instrument")
        dominst.Value = ThisWorkbook.Sheets("sheet1").Range("a1").Value
    
    End With


End Sub

Can you interact with anything else on the page? Looping through items may be an option, or worst case getting somewhere and tab-ing through.
 
Upvote 0
Do you have any reference libraries added? I have a file I use for IE which has the following (you may need one or two, it's been a while since I added them or looked into it). A bit of a long shot as I believe you'd have a different error if this was the case.

Microsoft XML
Microsoft HTML Object Library
Microsoft Internet Controls
 
Upvote 0
Looks like a pretty standard input, can't see where the issue would lie from the info given. I'd use a near identical:

Code:
Sub IEnav()


    Dim IE As Object
     
Set IE = CreateObject("InternetExplorer.Application")


    With IE
        .Visible = True
        .navigate "www.google.com.au"
    While .Busy Or .ReadyState <> 4: DoEvents: Wend


        Set dominst = IE.Document.getElementById("Domain_Instrument")
        dominst.Value = ThisWorkbook.Sheets("sheet1").Range("a1").Value
    
    End With


End Sub

Can you interact with anything else on the page? Looping through items may be an option, or worst case getting somewhere and tab-ing through.

Hi, i tried this but was returned with an error " Run time Error '13': Type mismatch"
 
Upvote 0
Do you have any reference libraries added? I have a file I use for IE which has the following (you may need one or two, it's been a while since I added them or looked into it). A bit of a long shot as I believe you'd have a different error if this was the case.

Microsoft XML
Microsoft HTML Object Library
Microsoft Internet Controls

Hi no...i do not have any reference library
 
Upvote 0
i have checked the boxes but still its the same error. Is there anything else i can share of the script so you will have a better idea?
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,242
Members
452,623
Latest member
russelllowellpercy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top