Rocket Software Homepage
Forum Home Forum Home > AccuTerm Knowledge Base (read only) > File Transfer
  New Posts New Posts RSS Feed - Updated Mailmerge Subroutine
  FAQ FAQ  Forum Search   Register Register  Login Login

The AccuTerm forum has moved. Go to community.rocketsoftware.com to register for the new Rocket forum.

Forum LockedUpdated Mailmerge Subroutine

 Post Reply Post Reply
Author
Message
MEDPSD View Drop Down
Newbie
Newbie


Joined: March 05 2008
Location: United States
Status: Offline
Points: 32
Post Options Post Options   Thanks (0) Thanks(0)   Quote MEDPSD Quote  Post ReplyReply Direct Link To This Post Topic: Updated Mailmerge Subroutine
    Posted: February 12 2014 at 6:25am
The new mailmerge subroutine updated by Pete uses a third parameter called DESTINATION. My test is blowing up with a script error at line 10 unexpected text '\'. I'm using the same path as my template and my merge data of \\ourservername\docs$\pdonnelly\mailmerge\newname.docx. What should I be using?
Back to Top
PSchellenbach View Drop Down
Admin Group
Admin Group

Moderator

Joined: December 15 2003
Location: United States
Status: Offline
Points: 2150
Post Options Post Options   Thanks (0) Thanks(0)   Quote PSchellenbach Quote  Post ReplyReply Direct Link To This Post Posted: February 12 2014 at 8:10am
Hi Patrick -

The DESTINATION argument is documented in the ATWORDMERGE routine:
EQU wdSendToNewDocument TO 0

EQU wdSendToPrinter TO 1
EQU wdSendToEmail TO 2
I don't think the "send to email" destination works, but the other two (0 or 1) should.

Thanks,

Pete
Back to Top
MEDPSD View Drop Down
Newbie
Newbie


Joined: March 05 2008
Location: United States
Status: Offline
Points: 32
Post Options Post Options   Thanks (0) Thanks(0)   Quote MEDPSD Quote  Post ReplyReply Direct Link To This Post Posted: February 12 2014 at 8:22am
Thanks Pete. Only issue now is the document is opening and immediately closing. How do I make it stay so I can save it?
Back to Top
PSchellenbach View Drop Down
Admin Group
Admin Group

Moderator

Joined: December 15 2003
Location: United States
Status: Offline
Points: 2150
Post Options Post Options   Thanks (0) Thanks(0)   Quote PSchellenbach Quote  Post ReplyReply Direct Link To This Post Posted: February 12 2014 at 10:27am
Hi Patrick -

I'm thinking that if we skip the "Quit" method at the end of the routine, Word should stay open and allow you to save the merged document. Try changing from:
SCR = SCR:EM:'WordApp.Quit'
to
IF DESTINATION = wdSendToPrinter THEN SCR = SCR:EM:'WordApp.Quit'

Let me know if this resolves the problem.

Thanks,

Pete
Back to Top
MEDPSD View Drop Down
Newbie
Newbie


Joined: March 05 2008
Location: United States
Status: Offline
Points: 32
Post Options Post Options   Thanks (0) Thanks(0)   Quote MEDPSD Quote  Post ReplyReply Direct Link To This Post Posted: February 13 2014 at 4:59am
Now it opens Word, the merged document appears and quickly disappears, and Word stays open. It seems Windows 2013 doesn't cooperate.
Back to Top
MEDPSD View Drop Down
Newbie
Newbie


Joined: March 05 2008
Location: United States
Status: Offline
Points: 32
Post Options Post Options   Thanks (0) Thanks(0)   Quote MEDPSD Quote  Post ReplyReply Direct Link To This Post Posted: March 13 2014 at 12:52am
Mailmerge still fails with Word 2013. Commenting out 'WordApp.Quit' kept Word open, but the document appeared and disappeared quickly. Commenting out'SaveChanges=False' resulted with the document staying on the screen but the merge failed. The merge fields remained as they are on the template i.e. <<DICT NAME>>
Back to Top
PSchellenbach View Drop Down
Admin Group
Admin Group

Moderator

Joined: December 15 2003
Location: United States
Status: Offline
Points: 2150
Post Options Post Options   Thanks (0) Thanks(0)   Quote PSchellenbach Quote  Post ReplyReply Direct Link To This Post Posted: March 14 2014 at 7:11am
Hi Patrick -

I found the problem - there is a bug in Word 2013 mail merge that is causing the problem. You need to set the View property of the ActiveWindow to wdPrintView in order to use the MailMerge.OpenDataSource method. The code linked to in the mail-merge tech article has been updated to include this change.

Thanks,

Pete
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.03
Copyright ©2001-2019 Web Wiz Ltd.