Solved

How to resolve "Error 429 ActiveX component can't create object " in VBA for EXCEL

Posted on 2007-03-23
3
2,118 Views
Last Modified: 2008-01-09
Hi All,

Im working on Excel Apllication using VBA.Im got a pice of code from experts exchange regarding to BROWSE button in VBA(i-e similar to windows browse button to open files).
Now my Problem is that i the macro i have written works fine for my Pc but when i run the macro in some other Machine, it gives me the following error when i try to click the Browse Button

"Error 429 ActiveX component can't create object "

Here is my piece of code that i tool from from other thread over here.
 

Function browseForFile() As String

On Error GoTo err_openFiledialog
   
   
    Dim myDialog As Object
   
   
    Set myDialog = CreateObject("MSComDlg.CommonDialog")
   
    myDialog.CancelError = True  'Catch the cancel button as an error
    myDialog.MaxFileSize = 255
   
    myDialog.ShowOpen
   
    browseForFile = myDialog.Filename
    Me.txtFileName = myDialog.Filename
    Set myDialog = Nothing
   
    Exit Function
   
err_openFiledialog:
   
    If Err.Number = 32755 Then 'cancel was selected
        browseForFile = ""
    Else
        MsgBox Err.Description, vbOKOnly + vbExclamation, "Error: " & Err.Number, Err.HelpFile, Err.HelpContext
    End If
   
    'Clean up object
    If Not myDialog Is Nothing Then Set myDialog = Nothing
   
    Exit Function
End Function
I have tried registering the Comdlg32.ocx in other machines and also tried copying th file from my Pc to other but still the macro gives me error.

Could anyone help me with this please? It really Urgent and i need to make sure the macro runs perfectly in all the Client Machines
I
0
Comment
Question by:ammartahir1978
3 Comments
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 500 total points
ID: 18781857
Have you thought about using Application.GetOpenFilename instead?
Regards,
Rory
0
 
LVL 11

Expert Comment

by:TreyH
ID: 18787438
It's a licensing issue. The machine you are using has some Microsoft Development tools installed that allows it to work. You can't directly create the CommonDialog object without a development license. You might look at some 3rd party tools that do the same and require no license? I've used some from this site: http://ccrp.mvps.org/   They are no longer under development but the ones I've used work fine.
0
 

Author Comment

by:ammartahir1978
ID: 18814852
Sorry for not replying guys.
rorya: It works great.Solved my problem.Thanks alot
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now