0

The following code snippet usually works to create an Internet Explorer instance and navigate a link:

Dim appIE As Object
Dim myLink As String: myLink = "www.something.com"

Set appIE = CreateObject("internetexplorer.application")
With appIE
  .Navigate myLink
  .Visible = True
End With

The problem is that, depending on the link (myLink), the page is navigated but then the interface becomes unknown and the object appIE contains no variable.

For example, if

myLink = "https://www.facebook.com"

... the object appIE shows the Facebook login page and can be used by the code (i.e. if I add a watcher, I can see all the properties of the object. However, if the link is:

myLink = "https://mxjira.murex.com/secure/RapidBoard.jspa?rapidView=2030&view=detail&cb=7055"

... the object appIE raises an "unknown interface" error and, seen by the watcher, this object contains no variable.

The link above is protected (it's an internal page of my company), but should still give an idea of the issue. The browser, with appIE.Visible = True, is actually showing the webpage. Why is the object losing all its variables then? How can I fix this "unknown interface" issue, where is it coming from if I can see the content of the webpage in the browser I just created?

Matteo NNZ
  • 9,069
  • 9
  • 43
  • 71
  • check the `.readystate` and `.busy` of the IE, it could be loading something that's taking time/not working. – Nathan_Sav Aug 21 '17 at 09:15
  • @Nathan_Sav done, the status is ready (4). – Matteo NNZ Aug 21 '17 at 09:27
  • is it busy? Check that as well. – Nathan_Sav Aug 21 '17 at 09:28
  • @Nathan_Sav actually, the issue is that appIE basically doesn't exist anymore after having navigated the link. I can't access neither appIE.busy nor other properties, I can just check the readystate directly on the browser that has been created but not from the VBA IDE itself. – Matteo NNZ Aug 21 '17 at 09:30
  • Have you seen this? https://stackoverflow.com/questions/12965032/excel-vba-controlling-ie-local-intranet – Nathan_Sav Aug 21 '17 at 09:37
  • @Nathan_Sav yes, but still the same issue. Once I navigate that page, my variable appIE basically becomes empty (it's not "Nothing", but it's just empty - unknown, as it says). Hence, I can't apply the checks described there. – Matteo NNZ Aug 21 '17 at 12:41
  • have you tried using inernetexploremedim as discussed in the post. – Nathan_Sav Aug 21 '17 at 12:46
  • Hello @Nathan_Sav, I finally solved the issue using the internetexplorermedium! Would you like to write it as an answer so that I can accept it and close the thread? Thanks! – Matteo NNZ Aug 22 '17 at 10:59

1 Answers1

2

If you read the following

Excel VBA Controlling IE local intranet

If you use InternetExplorerMedium instead of InternetExplorer, it should correct your issue.

Thanks.

Nathan.

Nathan_Sav
  • 7,539
  • 1
  • 10
  • 19