By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,456 Members | 982 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,456 IT Pros & Developers. It's quick & easy.

GetObject(,"InternetExplorer.Application") unhandled exception

P: n/a
Trying to automate processing 80,000 data sets through 15 web pages.
Application URL creates a new IE instance in which runs first a login form
and then runs the rest of the pages in the new window.

I can connect to a running Excel instance and obtain information from the
Excel DOM. I cannot do the same with Internet Explorer. However, I can
successfully create an new IE instance and manipulate it. Using an
application that has its own VB derived scripting language I get a similar

Sample VB.NET code showing ability to connect running Excel instance,
Creating an IE instance and then failing to connect to the instance is pasted
below. No try/Catch block indicates the problem is in
microsoft.visualbasic.dll. Any ideas or work arounds? VB prefered but I am
comfortable with C# and have used many other languages.

=== Output From Code as pasted ====
Excel: Renamed Sheet1
myIE.Name = Microsoft Internet Explorer
myIEDoc.url =
Exception Message: Cannot create ActiveX component.

=== Output From code with no Try/Catch block ====
Excel: Renamed Sheet1
myIE.Name = Microsoft Internet Explorer
myIEDoc.url =

An unhandled exception of type 'System.Exception' occurred in

Additional information: Cannot create ActiveX component.

=== Sample Code =====
Public Class MyExplorer
Public Shared Sub main()

' Block 1, pick up running Excel
Dim myExcel As Object
Dim myActive As Object
Dim s As String
myExcel = GetObject(, "Excel.Application")
myActive = myExcel.ActiveSheet
s = CType(myActive.Name, String)
Console.WriteLine("Excel: " + s)

' Block 2, Create Internet Explorer object and navigate
Dim myIE As New SHDocVw.InternetExplorerClass
s = ""
myIE = CType(CreateObject("InternetExplorer.Application") ,
myIE.Visible = True

End While

s = CType(myIE.Name, String)
Console.WriteLine("myIE.Name = " + s)

Dim myIEDoc As mshtml.IHTMLDocument2
myIEDoc = CType(myIE.Document, mshtml.IHTMLDocument2)
Console.WriteLine("myIEDoc.url = " + myIEDoc.url)

' Block 3, try to point to the running Internet Explorer
Dim myIE2 As SHDocVw.InternetExplorerClass
s = ""
myIE2 = CType(GetObject(, "InternetExplorer.Application"),
myIE2.Visible = True

Catch ex As Exception
While True
Console.WriteLine("Exception Message: " + ex.Message)
If ex.InnerException Is Nothing Then
Exit While
ex = ex.InnerException
End If
End While
End Try

If myIE2 Is Nothing Then Exit Sub

End While

s = CType(myIE2.Name, String)
Console.WriteLine("myIE2.Name = " + s)

Dim myIEDoc2 As mshtml.IHTMLDocument2
myIEDoc2 = CType(myIE.Document, mshtml.IHTMLDocument2)
Console.WriteLine("myIEDoc2.url = " + myIEDoc2.url)

End Sub
End Class

Software developer/Tester
Nov 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.