Iron3eagle
Iron3eagle

Reputation: 1077

VBA InternetExplorer.Application Object Hang

I'm using an old Excel document with VBA that works fine with IE 11 on Windows 7, however on IE 11 on Windows 10 it does not work. IE 11 launches to the URL requested but that's it. Anytime I try to access a event, method, or property, it stops. No error code, no crash, just stops.

I've confirmed that my references to Microsoft Internet Controls and Microsoft HTML Object Library are included (they weren't but they are now).

Dim ie As Object

If ie Is Nothing Then
   Set ie = CreateObject("InternetExplorer.Application")
   ie.Visible = True
End If

url = "www.myurl.com"

ie.Navigate url

While ie.ReadyState <> 4 Or ie.Busy: DoEvents: Wend

Code bellow the check never executes, I placed MsgBox code before and after for testing. Only MsgBox before the loop works, unless I try to use MsgBox ie.Document.Title, but I can do MsgBox ie.ReadyState or MsgBox "Loading webpage" just fine.

Again the code works perfectly fine no problem on Windows 7 with IE 11, but does not work on Windows 10 with IE 11. Tested on multiple W7 and W10 machines with identical results.

Upvotes: 2

Views: 2435

Answers (1)

Iron3eagle
Iron3eagle

Reputation: 1077

After trying many different options I was finally able to get it to work. Per OmegaStripes recommendation, I began messing with the compatibility modes. Like many things, the simplest solution ended up being the correct one. After adding my intranet site to the compatibility view settings it worked perfect with zero code changes to the VBA.

  1. Launch IE 11
  2. Click Tools
  3. Click Compatibility View Settings
  4. Type your URL into the text area and click Add
  5. Check Display Intranet sites in Compatibility Mode
  6. Click Close

After doing this I exited IE 11, restarted my Excel spread sheet with the VBA that was previously not functioning. Executed the VBA code, and it worked just as it did on Windows 7 with IE 11.

Hope this helps some one else and saves them a lot of headache.

Special thanks to OmegaStripes for sticking through this with me and helping me see the actual problem rather than over thinking it.

Upvotes: 1

Related Questions