Open and write data to Edge

itms

Active member
Joined
Feb 21, 2018
Messages
33
Programming Experience
10+
Hi,

I have been tasked to develop an application that will open the MS Edge website and then write data to the text boxes on the form. I have been researching and I found some basic code that I have below, that will open Internet Explorer and allow you to write to a text box there.
I wrote the application with this code and it works great but opens in IE instead of Edge. So, I tried adding IE.Navigate("microsoft-edge:The envy of postcards and snow globes") instead of IE.Navigate("The envy of postcards and snow globes"), and this will open it in Edge, but then the written to the textbox will not work ( objCollection = IE.document.getelementsbyname("q")).

Question: How can I get this to open in MS Edge and be able to write to the fields there?
Thank you

My Code:
Ie Code:
   Dim IE As Object 'Internet explorer object
        Dim objCollection As Object 'Variable used for cycling through different elements

        'Create IE Object
        IE = CreateObject("InternetExplorer.Application")
        IE.Visible = True
        IE.Navigate("microsoft-edge:https://www.bing.com/") 'Your website

        Do While IE.Busy
            Application.DoEvents() 'This allows the site to load first
        Loop

        'Find the field you are looking for and store it into the objCollection variable sb_form_q
        objCollection = IE.document.getelementsbyname("q") 'The "CustomerInfo.AccountNumber" is the name of the element I looked for in this case.

        'Call element, and set value equal to the data you have from your form
        objCollection(0).Value = "House Test"

        ' Clean up
        IE = Nothing
        objCollection = Nothing
 
Back
Top