Automate Word OLE32 merge printing with Ruby

Discussion in 'Ruby' started by Damjan Rems, Jun 29, 2009.

  1. Damjan Rems

    Damjan Rems Guest

    What I would like to do is automate merge print documents without user
    interference.

    I have come so far:

    fso = WIN32OLE.new("Scripting.FileSystemObject")
    word = WIN32OLE.new('Word.Application')
    path = fso.GetAbsolutePathName(ARGV.first)
    doc = word.Documents.Open(path)
    path = fso.GetAbsolutePathName('some.xls')
    doc.MailMerge.OpenDataSource(path)


    My questions:
    At the line:
    doc.MailMerge.OpenDataSource(path)
    Words asks for choosing table (which is actualy a worksheet in excel
    file). How can this be supresses or set automaticaly?

    How to print all resulting documents?
    Recorded macro says:
    With ActiveDocument.MailMerge
    .Destination = wdSendToPrinter
    .SuppressBlankLines = True
    With .DataSource
    .FirstRecord = 1
    .LastRecord = 1
    End With
    .Execute Pause:=False
    end


    by
    TheR
    --
    Posted via http://www.ruby-forum.com/.
     
    Damjan Rems, Jun 29, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vijay Neelam

    Automate word ?

    Vijay Neelam, Oct 29, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    401
    Vijay Neelam
    Oct 29, 2003
  2. Martin Feuersteiner
    Replies:
    0
    Views:
    2,997
    Martin Feuersteiner
    Jul 19, 2004
  3. =?Utf-8?B?TXJNaWtl?=

    Automate Webform Printing

    =?Utf-8?B?TXJNaWtl?=, Dec 16, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    724
    tomBond
    Dec 17, 2004
  4. Chris Kettenbach

    Automate Word 2003 from ASP.NET?

    Chris Kettenbach, Jul 6, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    479
    Olivier Verdin
    Jul 6, 2005
Loading...

Share This Page