Forum Discussion

GaryTr755's avatar
GaryTr755
Copper Contributor
Aug 30, 2021

What is the code to run IE in Edge?

We have been developing an Excel/VBA program for over 20 years and it is up to 2000 lines of code and an extensive use of Excel spread sheet. Now that Edge has taken over IE. the our program no longer works. The need is to invoke a browser and set a URL. After one hour, the browser is to close and a new browser session will open with another URL. This has to be done without any manual intervention, not even a click.

 

The code has been working very well in IE but now that Edge has taken control, the code opens a new tab for each URL presented on the hour but the tab remains open. On the second hour, two URL/tabs are playing and for each subsequent hour, another URL/tab will be playing. At the moment, I have to be here on the hour to close the old tab(s). Since the program runs for 24 hours, my closing tabs manually is not an option. It has to be automated.

 

Here are the key commands I am using:

 

To open the browser from one sub:

 

Dim obj As Object

Set obj = CreateObject("InternetExplorer.Application") obj.Navigate ThisURL

 

And this code to close the browser from another sub:

 

Dim obj As Object: Dim ie As Object

Set obj = CreateObject("shell.application")

For Each ie In obj.Windows

On Error GoTo ForgetMe

If TypeName(ie.Document) = "HTMLDocument" Then

ie.Quit

Instances = Instances - 1

 

What is the new Edge code to open a browser for each hour and to close it after each hour. Also acceptable would be if there is code to open and close tabs.

 

I have about 400 members of the community who benefit from the output of this program so it is no trivial matter.

  • JimGrisham's avatar
    JimGrisham
    Steel Contributor

    GaryTr755 

     

    Two questions for you:

    1. Is your problem not being able to use your program to open a page / site in Edge using IE mode at all, or is the issue that you are using IE Mode, but Edge in IE Mode is acting differently in some way (i.e. in not allowing the tab to be closed on a timer) than IE11 does?
    2. On which release channel(s) (i.e. Public, Beta, Dev, or Canary) of Edge have you experienced this?

     

    In the meantime, the notes below may help you and others in similar situations.

     

     - Jim

     


    Microsoft is committed to minimize impacts to existing applications from IE11 to Edge:


    From this Windows IT Pro blog post:

    • Apps developed for IE should work in Microsoft Edge through IE mode. If you encounter an issue, contact App Assure for remediation assistance (ACHELP@microsoft.com).
    • IE to Microsoft Edge Redirection
      • It appears this is for the opposite case as yours (i.e. when a website is changed to make it incompatible with IE11) but there may also be a whitelist for sites on which to enforce IE mode in Edge

    If the support teams are contacted directly, then they will be more aware of your specific type of issue and may be able to make changes or publish guidance to better help others with similar issues in the future.

     

    M365 customers with at least 150 seats (officially... there may be some flexibility there?) should probably start with App Assure via FastTrack, but there are options for everyone:

     

    • Support for individuals
      -------------------------
      Need assistance with Microsoft Edge? File a ticket and we'll be there to help.

    • Support for business
      -----------------------
      MICROSOFT EDGE BETA ONLY
      1:1 help is available via a variety of plans to help you get the level of support you need.

    • App Assure
      -------------
      Issues with your business apps or websites on the latest version of Microsoft Edge? Microsoft will help you fix them at no additional cost.
    • jkrafka's avatar
      jkrafka
      Copper Contributor

      JimGrisham 

      I am having a similar issue... but dont see an answer to it in your reply.

      I also have a program in Excel vba which needs to open a browser like:

      Set ie = CreateObject("InternetExplorer.Application")
      With ie
      .Visible = True
      .navigate "https://www.example.com"
      Do Until .readyState = 4: DoEvents: Loop ....................

       

      The problem is that the code ALWAYS opens IE11. How can I have the code open Edge instead? what will happen after June 22 when IE gets deprecated?

      • Mohtadi's avatar
        Mohtadi
        Copper Contributor
        any clues if you have been able to find a solution for this ? 🙂 thanks!

Resources