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
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