PC Review


Reply
Thread Tools Rate Thread

Macro to call maiMerge function

 
 
fai
Guest
Posts: n/a
 
      28th Mar 2007
Dear all:

I have a problem in calling MailMerge function in macro with following
coding.

It's failed at word.mailmerge statement with
"run time error 4198 Application-defined or object-defined error"

Can any expert help to resolve




curdirectory = "F:\Project"
'fileName = curdirectory + "\sample.doc"
fileName = curdirectory + "\Model.doc"
fileNam2 = curdirectory + "\Model_eCert_PassdLabel.doc"
filedatasource = curdirectory + "\Fai_Temp_CARD.XLS"
Set wordDoc = GetObject(fileName, "word.document")
wordDoc.Application.Visible = True
wordDoc.MailMerge.MainDocumentType = wdFormLetters

With wordDoc.MailMerge
.OpenDataSource Name:=filedatasource, _
ConfirmConversions:=False, ReadOnly:=False, LinkToSource:=True,
_
AddToRecentFiles:=False, PasswordDocument:="123456",
PasswordTemplate:="", _
WritePasswordDocument:="123456", WritePasswordTemplate:="",
Revert:=False, _
Format:=wdOpenFormatAuto, _
Connection:="Provider=Microsoft.Jet.OLEDB.4.0;Password="""";User
ID=Admin;Data Source=" + filedatasource + ";Mode=Read;Extended
Properties=""HDR=YES;IMEX=1;"";Jet OLEDB:System database="""";Jet
OLEDB:Registry Path="""";Jet OLEDBata" _
, SQLStatement:="SELECT * FROM `Working$`", SQLStatement1:="",
SubType:= _
wdMergeSubTypeAccess
End With
wordDoc.MailMerge.Execute Pause:=True
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Function to call macro ranswert Microsoft Excel Programming 1 15th Jan 2008 11:02 PM
just need to create a function and call it with a macro =?Utf-8?B?QW1hbmRhIEJ5cm5l?= Microsoft Access Macros 1 15th Aug 2006 05:00 PM
call VBA function from macro =?Utf-8?B?U291cmlz?= Microsoft Access 1 9th Jun 2005 11:05 AM
function or call macro marko Microsoft Excel Programming 4 8th Dec 2003 04:31 PM
Call Excel Macro/Function from PPT daMike Microsoft Powerpoint 1 13th Aug 2003 01:41 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:05 PM.