VBA Runtime error 429 while creating an object of Shell32.dll

552 views Asked by At

I am trying to write a VBA function which will get the handle for a specific already open IE window. I have found below code after some googling for this:-

Public Function FindIEObject(target As String) As InternetExplorerMedium
Set objShell = CreateObject("Shell.Application")
IE_count = objShell.Windows.Count
For x = 0 To (IE_count - 1)
    On Error Resume Next    
    my_url = objShell.Windows(x).Document.Location
    my_title = objShell.Windows(x).Document.Title
    If InStr(my_title, target) > 0 Then 
        Set FindIEObject = objShell.Windows(x)
        Set myIE = objShell.Windows(x)
        Exit For
    End If
Next
End Function

This code works absolutely fine on my computer, however when I deploy the tool in the Citrix environment of our client I get error "ActiveX component can't create object" on the line 3

I did some research on google and basis that took help of the Citrix Administrator - tech support guy to replace the shell32.dll file in the windows/system32 folder with fresh new copies and got it re-registered.

After doing this I was expecting the code to run fine however I am still receiving same runtime error 429 "ActiveX component can't create object".

Please if somebody can help me understand what needs to be done to make the code work fine. Thanks in advance.

Premanshu

1

There are 1 answers

0
Deepak-MSFT On

This error occurs when the Component Object Model (COM) cannot create the requested Automation object, and the Automation object is, therefore, unavailable to Visual Basic. This error does not occur on all computers.

In Visual Basic, there are several causes of error 429. The error occurs if any of the following conditions is true:

(1) There is a mistake in the application.

(2) There is a mistake in the system configuration.

(3)There is a missing component.

(4)There is a damaged component.

You can try to Examine the code, Examine the automation server and Examine the system to narrow down the issue.

You can try to refer link below may give you some more useful information.

You receive run-time error 429 when you automate Office applications