473,404 Members | 2,179 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

GetObject(,"InternetExplorer.Application") unhandled exception

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
error.

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 = http://www.yahoo.com/
Exception Message: Cannot create ActiveX component.

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

An unhandled exception of type 'System.Exception' occurred in
microsoft.visualbasic.dll

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") ,
SHDocVw.InternetExplorer)
myIE.Visible = True
myIE.Navigate2("www.yahoo.com")

While myIE.ReadyState <> SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE
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 = ""
Try
myIE2 = CType(GetObject(, "InternetExplorer.Application"),
SHDocVw.InternetExplorer)
myIE2.Visible = True
myIE2.Navigate2("www.microsoft.com")

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

If myIE2 Is Nothing Then Exit Sub

While myIE2.ReadyState <> SHDocVw.tagREADYSTATE.READYSTATE_COMPLETE
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
0 10091

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jonathan Trevor | last post by:
Hi, Spent nearly 8 hours googling and trying code on this yesterday without much success. I'd like to write a .NET application (using .NET primitives, older Win32 calls, or WMI etc) to work out...
3
by: Yitzhak | last post by:
I am having "Permission denied" error while calling LogEvent method of WScript.Shell component. Basically, ASP page calls Windows Script Host Shell component to log events to the OS Application...
8
by: Hakan | last post by:
I use the following code to check if a user is an admin in the login page of our intranet. Set User = GetObject("WinNT://" & UserDomain & "/" & UserName & ",user" For Each Group in User.Group...
7
by: Dica | last post by:
i've used the sample code from msdn to create an encyption/decryption assembly as found here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetHT10.asp i'm...
0
by: chaf2701 | last post by:
Hi, I was in trouble with the System.Windows.Forms.ImageList control from VC.NET. I was doing the following : 1. New Project, C#, Windows Application 2. Add ImageList component imageList1 to...
1
by: Jeff | last post by:
All, I have a simple ASP web application that has been working great for years, and now we are moving to Active Directory. The following code is in my global.asa file, but is not working...
0
mmfranke
by: mmfranke | last post by:
Hello. Hi. I'm writing a logging service that uses .NET remoting. The idea is that the service publishes an EventProcessor object that clients can access via .NET Remoting, passing it...
2
by: Wimpie van Lingen | last post by:
Hey I have some more questions with regards to Remoting in .NET 2. I'm using TCP with the Binary formatter. My solution consists of 4 projects: - Class Library containing the server classes...
3
by: wingsganesh | last post by:
Hi buddys, I have the followinf Bug......... when i run my application "NotSupportedException was un handled" in "System.Drawing.Icon" for the following designer code.... ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.