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
Solved

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

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA: loop recent folder and copy txt file. 8 33
Problem with a moving column in Excel 6 37
Turn date into age 17 31
excel conditional formating 4 12
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
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…

792 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