0

I'm using some code found here elsewhere on Stack, but I get an unusual run time error that I can't seem to find any info on:

Run-time error '-2147023179 (800706b5)' Automation error The interface is unknown.

With so little info on it, and what info existing being barely relevant, I started to think it has to do with References. I added one that I read about that seemed like it could help (Microsoft Internet Controls), but it didn't. Am I missing something others that may be required? Any direction would really be helpful.

The error occurs on the following line of code:

IE.Document.getElementById("CRM_Number").Value = "CRM12345"

This is the ORIGINAL code, which I only changed the website and the ElementID (can only access on VPN so won't help to link here). Presumably, this will work fine unless it's been changed since posted:

 Dim IE As Object

 Sub submitFeedback3()
 Application.ScreenUpdating = False

 Set IE = CreateObject("InternetExplorer.Application")
 IE.Visible = True
 IE.Navigate "http://spreadsheetbootcamp.com/excel-efficiency-trainer-feedback/"

 Application.StatusBar = "Submitting"
  ' Wait while IE loading...
  While IE.Busy
  DoEvents
  Wend
  **********************************************************************
  IE.Document.getElementById("Form_Attempts-1372643500")(0).Value = "1"
  IE.Document.getElementById("submit-1-1372643500")(0).Click
  **********************************************************************
  Application.StatusBar = "Form Submitted"
  IE.Quit
  Set IE = Nothing

 Application.ScreenUpdating = True
 End Sub
Community
  • 1
  • 1
alyehoud
  • 136
  • 2
  • 13
  • 3
    You first need to post the line of code where the error occurs, otherwise it's impossible to answer. – Matteo NNZ Jan 06 '15 at 17:16
  • Error occurs at this line: IE.Document.getElementById("CRM_Number").Value = "CRM12345" – alyehoud Jan 06 '15 at 17:20
  • Also, please tell us what you are trying to achieve. – silentsurfer Jan 06 '15 at 17:58
  • 1
    You'll preferably also want to show us the minimum amount of code required for us to troubleshoot (i.e., the entire subroutine/function that you're using) as well as the URL you're trying to access... – David Zemens Jan 06 '15 at 18:02
  • 1
    code added in original post, thanks for help!! – alyehoud Jan 06 '15 at 18:12
  • It would help if you could add the line of HTML with the `` tag (and possibly a line above and below it to see it in context). –  Jan 06 '15 at 18:25
  • 1
    If you cannot give us the link, it's going to be complicated. Please post some HTML in that case. Maybe also provide us some info about the browser version and the operating system, it might be something is wrong there if the error is just "interface is unknown" . Even if I must admit that the line of code where the error occurs can hardly raise that kind of exception (it would have raised it before). – Matteo NNZ Jan 06 '15 at 18:26
  • What version of IE are you using? – David Zemens Jan 06 '15 at 18:26
  • I seem to recall some websites render such that `IE.Document` is `Nothing` in which case I think the workaround was to use `IE.Document.Body...` instead. – David Zemens Jan 06 '15 at 18:28
  • Or you may consider abandoning IE in favor of a more reliable method like XMLHTTPRequest, here is an example: http://stackoverflow.com/questions/11909580/automation-errors-800706b5-80004005-80010108-appear-for-internal-sap-site-scr – David Zemens Jan 06 '15 at 18:30
  • 1
    @DavidZemens if the object is nothing, it would raise "Object required" error. Rather, I'd think about the "DoEvents", maybe it's not enough so it loads an incomplete object. Have you tried adding an application waiter, or even better to run the code in debug and see if the same happens? – Matteo NNZ Jan 06 '15 at 18:30
  • See also: https://social.technet.microsoft.com/Forums/scriptcenter/en-US/49f829b6-3c04-403c-97b0-6480aaba3fbe/code-800706b5-the-interface-is-unknown-windows-7-ie-9-vbscript – David Zemens Jan 06 '15 at 18:32
  • I have found that many times when I am using IE with VBA I need to add two reference libraries, Internet controls and HTML Object Library. You have one but maybe not the other? – Thomas Beck Sutton Jan 06 '15 at 18:51
  • This might turn to be a very stupid comment, but just to make sure and to stick on your "I have just changed the website and the ID"... Have you removed the ´************´ stuff from the code? – Matteo NNZ Jan 06 '15 at 18:55
  • `getElementById()` returns a single element, not a collection, so you should drop the `(0)` from those lines – Tim Williams Jan 06 '15 at 19:25

0 Answers0