Excel Mail Merge - Runtime error 429

dirtychinchilla

Board Regular
Joined
Jun 21, 2013
Messages
234
Hi guys,

So ages ago some helpful chaps here helped me work on this code, which gives users a button in Excel that they can press to transer a quote automatically into a word document via a mail merge. This has been working beautifully for ages, but one user (new) is now getting runtime error 429 when he reaches the "With CreateObject" line. Could anyone give me an insight into what's going wrong?? I'd really appreciate it.

Thanks in advance,

Jonathon

Code:
Sub FSMerge()

    Dim objDoc As String, B As Integer
    
    objDoc = "Q:\Temp\FSTemp.xls"
     
On Error GoTo ErrHandler:

    If MsgBox("Do you want to continue with the mail merge? If nothing happens, check whether a dialog box has opened in the background, or wait 30 seconds and try again. When the dialog box opens, please press yes to accept the mail merge.", vbYesNo, "Confirm") = vbNo Then
        Exit Sub
    End If
    
    ThisWorkbook.SaveCopyAs Filename:=objDoc
    
    With CreateObject("Q:\Index\Documents\Quotation.dotm")
        DoEvents
        .Application.Visible = True
        .MailMerge.Execute
        .Close 0
    End With

    Kill objDoc
     
     'Skip error handler
    Exit Sub
          
ErrHandler:
    Kill objDoc
    MsgBox ("Run-time Error " & Err.Number)
    Exit Sub

End Sub
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

baitmaster

Well-known Member
Joined
Mar 12, 2009
Messages
2,039
runtime error 429 is one of those that's hard to pin down what the issue actually is. See https://support.microsoft.com/en-us/kb/828550 for details including suggested diagnosis approach

Essentially the machine can't create the object from the template. My first point would be, is the address correct? You're using the Q drive shortcut instead of the full UNC path (Universal Naming Convention), there's a good chance this is your problem
 

dirtychinchilla

Board Regular
Joined
Jun 21, 2013
Messages
234
Hi baitmaster,

Yeah I've had a look at loads of things about the error code and it basically just seems to mean "it won't work." I've been on that link before and nothing seems to work.

Regarding the address, it's the same for maybe 10 PCs here, so it's weird that that's causing an error. I don't know what the UNC path is - could you explain more please?

dirtychinchilla
 

dirtychinchilla

Board Regular
Joined
Jun 21, 2013
Messages
234
baitmaster, I've just done a bit of research on the UNC path and got that, so pardon me for being lazy. I've now amended the code to use the UNC path and it's made no difference.
 

daverunt

Well-known Member
Joined
Jul 9, 2009
Messages
1,893
Office Version
  1. 2013
Platform
  1. Windows

ADVERTISEMENT

Quick check here. a dotm file is 2007 or late. Anyone running anything older?
 
Last edited:

dirtychinchilla

Board Regular
Joined
Jun 21, 2013
Messages
234
Nope, the guy who's having the problem is one of about 3 with the latest version of office. This is causing minor issues with the references, which I thought might be the problem, but I matched my settings (even though he has a newer version of office) and that didn't make a difference. Others with the same version seem to have no issue. It's very strange.
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,278
Office Version
  1. 365
Platform
  1. Windows

ADVERTISEMENT

Does this work?
Code:
Sub FSMerge()
Dim wrdObj As Object
Dim wrdDoc As Object 
Dim objDoc As String, B As Integer    

objDoc = "Q:\Temp\FSTemp.xls"
     
On Error GoTo ErrHandler:

    Set wrdObj  =CreateObject("Word.Application")

    wrdObj.Visible = True

    Set wrdDoc = wrdObj.Documents.Add(Template:="Q:\Index\Documents\Quotation.dotm"

    wrdDoc.MailMerge.Execute

    wrdDoc.Close 0

    Kill objDoc
     
     'Skip error handler
    Exit Sub
          
ErrHandler:
    Kill objDoc
    MsgBox ("Run-time Error " & Err.Number)
    Exit Sub

End Sub
 

dirtychinchilla

Board Regular
Joined
Jun 21, 2013
Messages
234
Hi Norie,

Thanks very much for that. I'm afraid it has an error 4605 when it gets to wrdDoc.MailMerge.Execute!

dirtychinchlila
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,278
Office Version
  1. 365
Platform
  1. Windows
What's the error message?
 

Watch MrExcel Video

Forum statistics

Threads
1,129,361
Messages
5,635,812
Members
416,884
Latest member
leeshjay

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top