Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run-time error '429': ActiveX component can't create object From Excel to Word

remeng

Technical User
Jul 27, 2006
506
1
0
16
US
Hi,

I'd like to create a macro to open a Word document from Excel.

I am receiving Run-time error '429': ActiveX component can't create object when I execute the code.

I don't have admin privileges to perform the regedit that is called out in this article. This also has to work on several computers.

https://support.microsoft.com/en-us/topic/you-receive-run-time-error-429-when-you-automate-office-applications-b6070e15-ea78-4349-2751-72bdb5f186f7

I tried the following code and I get an error on step 1.

1: Set oWord = CreateObject("Word.Application")

Code:
Sub test ()

Dim oWord As Word.Application
 Dim oExcel As Excel.Application
 
 On Error Goto err_handler
 
 1: Set oWord = CreateObject("Word.Application")
 2: Set oExcel = CreateObject("Excel.Application")
 
 ' ... some other code
 
 err_handler:
   MsgBox "The code failed at line " & Erl, vbCritical

End Sub

Is there another way to get past the error?
 
Solution
Update - There was different code out there that works.

Sub test_open_pathway()


Dim objWord As Object
Dim pathway As String

pathway = "C:\some folder\labels test.docx"

Debug.Print pathway

Set objWord = CreateObject("Word.Application")
objWord.Visible = True
objWord.Documents.Open pathway



End Sub
Update - There was different code out there that works.

Sub test_open_pathway()


Dim objWord As Object
Dim pathway As String

pathway = "C:\some folder\labels test.docx"

Debug.Print pathway

Set objWord = CreateObject("Word.Application")
objWord.Visible = True
objWord.Documents.Open pathway



End Sub
 
Solution
The code in your first post employs early binding. Had you set a reference to Word via Tools|References in the VBA Editor?
 
Hmm. If they hadn't then

Dim Word As Word.Application

would have failed (with a 'user-defined type not defined' error), not the later

Set objWord = CreateObject("Word.Application")

Personally,. I'd start by running a repair against Word
 

Part and Inventory Search

Sponsor

Back
Top