• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2236
  • Last Modified:

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

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
    browseForFile = myDialog.Filename
    Me.txtFileName = myDialog.Filename
    Set myDialog = Nothing
    Exit Function
    If Err.Number = 32755 Then 'cancel was selected
        browseForFile = ""
        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
1 Solution
Rory ArchibaldCommented:
Have you thought about using Application.GetOpenFilename instead?
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.
ammartahir1978Author Commented:
Sorry for not replying guys.
rorya: It works great.Solved my problem.Thanks alot
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now