473,902 Members | 3,407 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

GetObject(,"Int ernetExplorer.A pplication") 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

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.visua lbasic.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.Excepti on' occurred in
microsoft.visua lbasic.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.Applicat ion")
myActive = myExcel.ActiveS heet
s = CType(myActive. Name, String)
Console.WriteLi ne("Excel: " + s)

' Block 2, Create Internet Explorer object and navigate
Dim myIE As New SHDocVw.Interne tExplorerClass
s = ""
myIE = CType(CreateObj ect("InternetEx plorer.Applicat ion"),
SHDocVw.Interne tExplorer)
myIE.Visible = True
myIE.Navigate2( "www.yahoo.com" )

End While

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

Dim myIEDoc As mshtml.IHTMLDoc ument2
myIEDoc = CType(myIE.Docu ment, mshtml.IHTMLDoc ument2)
Console.WriteLi ne("myIEDoc.ur l = " + myIEDoc.url)

' Block 3, try to point to the running Internet Explorer
Dim myIE2 As SHDocVw.Interne tExplorerClass
s = ""
myIE2 = CType(GetObject (, "InternetExplor er.Application" ),
SHDocVw.Interne tExplorer)
myIE2.Visible = True
myIE2.Navigate2 ("www.microsoft .com")

Catch ex As Exception
While True
Console.WriteLi ne("Exception Message: " + ex.Message)
Console.WriteLi ne()
If ex.InnerExcepti on Is Nothing Then
Exit While
ex = ex.InnerExcepti on
End If
End While
End Try

If myIE2 Is Nothing Then Exit Sub

End While

s = CType(myIE2.Nam e, String)
Console.WriteLi ne("myIE2.Name = " + s)

Dim myIEDoc2 As mshtml.IHTMLDoc ument2
myIEDoc2 = CType(myIE.Docu ment, mshtml.IHTMLDoc ument2)
Console.WriteLi ne("myIEDoc2.ur l = " + myIEDoc2.url)

End Sub
End Class

Software developer/Tester
Nov 21 '05 #1
0 10179

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

Similar topics

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 which users can log onto a machine the application is running on. The platforms I'd like to support are NT/2000/XP - although 98 would be good too. It looks like for 2000 and XP OS' the answer is listed in the "Local Security Policy" control...
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 Event log. My environment: Windows Server 2003, IIS 6, WSH, Classic ASP, Vbscript Below is the code and the error: Code:
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 Select Case Group.Nam Case "Domain Admins Session("Admin")=Tru Case "Domain Users Session("User")=Tru End Selec
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 able to encrypt and then decrypt data okay as in the following code: // encrypt the data // Encryptor enc = new Encryptor(EncryptionAlgorithm.TripleDes); byte key = Encoding.ASCII.GetBytes("0123456789012345");
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 Form1 3. in imageList1 properties open the 'Image Collection Editor' for Images and add a simple copy.bmp
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 anymore. Note, although we have upgraded to AD, the usernames have stayed the same. Sub Session_OnStart '**Session on Start code here ** strUsername=Replace(ucase(Request.ServerVariables("LOGON_USER")) ,
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 DiagnosticEvent objects for processing. I've altered the main program for the service slightly so that I can run it more easily as a "regular" application during debugging. I have an assembly that contains the "diagnostics" classes that do the work, the...
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 which Inherits MarshalByRefObject (ok, at this stage it only contains one class... but its gonna grow) - Class Library containing common classes and interfaces that will be shared between all projects. This include interfaces for the server...
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.... Me.picImgMain.Image = CType(resources.GetObject("picImgMain.Image"), System.Drawing.Image) can u give any idea
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.