internetexplorer.application object raises an “Aut

2019-09-18 14:26发布

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?

1条回答
再贱就再见
2楼-- · 2019-09-18 15:21

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.

查看更多
登录 后发表回答