Solved

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

Posted on 2007-03-23
3
2,108 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

This collection of functions covers all the normal rounding methods of just about any numeric value.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

746 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

13 Experts available now in Live!

Get 1:1 Help Now