Sign in to follow this  
Followers 0

Com and MS-Word Mail merge

2 posts in this topic


I am attempting to perform a mail merge using a word doc and tab delimited csv file and am failing badly.

I need some-one to convert a vb script to autoit for me.

Activedocument.MailMerge.OpenDataSource  _ 
      Name:="X:\WindowsIsWierd\Temp\merge.txt", _
      ReadOnly:=False, LinkToSource:=True, _
      PasswordDocument:="",  _
      PasswordTemplate:="", _
      WritePasswordDocument:="", _
      WritePasswordTemplate:="",  _
      Revert:=False, _
      Format:=wdOpenFormatAuto, _
      Connection:="", _
      SQLStatement:="", _
      SQLStatement1 _ :="")

To an autoIT version

Here is my attempt

$word = ObjCreate("word.application"); to run word
$word.visible = 1; to show it
$ & "\NewRateQuote.doc"); to make a new document
$mm = $word.MailMerge.OpenDataSource("Name:=" &@ScriptDir & "\MMNewQuote.csv, ReadOnly:=1, LinkToSource:=1," _
                                     & "AddToRecentFiles:=0, " _
                                     & "PasswordDocument:='', PasswordTemplate:='', WritePasswordDocument:='', " _
                                                                         & "WritePasswordTemplate:='', Revert:=0, Format:=0," _
                                                                         & "Connection:='', SQLStatement:='', SQLStatement1:=''")




Share this post

Link to post
Share on other sites

I have no way of testing it, but see if this works.

$oWord = ObjCreate("word.application")

With $oWord
    .visible = 1
    $oDoc = (@ScriptDir & "\NewRateQuote.doc")

$oMailMerge = $oDoc.MailMerge
$oMailMerge.OpenDataSource ('"' & @ScriptDir & '\MMNewQuote.csv"', 0, True, True, True, False, "", "", False)

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0