dougie Posted July 31, 2006 Share Posted July 31, 2006 Hi, 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", _ ConfirmConversions:=False,_ ReadOnly:=False, LinkToSource:=True, _ AddToRecentFiles:=False,_ 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 $word.documents.open(@ScriptDir & "\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:=''") $mm.Execute Thanks Dougie Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted July 31, 2006 Moderators Share Posted July 31, 2006 I have no way of testing it, but see if this works. $oWord = ObjCreate("word.application") With $oWord .visible = 1 $oDoc = .documents.open (@ScriptDir & "\NewRateQuote.doc") EndWith $oMailMerge = $oDoc.MailMerge $oMailMerge.OpenDataSource ('"' & @ScriptDir & '\MMNewQuote.csv"', 0, True, True, True, False, "", "", False) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now