Solved

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

Posted on 2007-03-23
3
2,156 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Suggested Solutions

Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

756 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