Word Freeze after using mailings via VBS script
hi everyone,
have got trouble application in service, application launch word template , fill mailing (publipostage in fr) option in word via vbs script, in fact after these steps word freeze, have reduce/extend windows , ok, notice problem occure during application of mailings (publipostage in fr), know quite stupid have find issue that.
thank you,
, sorry english,
edit : script, if delete part in bold template word don't freeze mailings don't work, maybe script not good?
thanks again,
all
' run word , open merge document
set owd = wscript.createobject("word.application")
owd.visible=true
owd.documents.open sdocfilename
' dynamically associates datasource main document , run merge
set omergedoc = owd.activedocument
set omerge = omergedoc.mailmerge
omerge.opendatasource sdatasource, 4 '4=wdopenformattext
omerge.destination = 0 ' 0 = wdsendtonewdocument
omerge.viewmailmergefieldcodes = false
omerge.execute
' after merge, main document no more merge document
omerge.maindocumenttype = -1 ' -1 = wdnotamergedocument
' no more merge document, doesn't maintain link data source :
' datasource file can deleted.
ofso.deletefile sdatasource
' result of merge considered 'saved' : message 'do want save ...'
' not displayed when closing it.
omergedoc.saved = true
' no need keep main document open
' warning : must last instruction of macro because other vba instructions
' ignored when container document closed
omergedoc.close
set owd=nothing
are sdocfilename , sdatasource both have the correct filepath , filename contents , sdatasource plain text file? , after:
set omerge = omergedoc.mailmerge
might need specify merge type, example:
omerge.maindocumenttype = 0 'wdformletters
i note script neither saves mailmerge output document nor closes word; take intention leave word running output document displayed.
cheers
paul edstein
[ms mvp - word]
Microsoft Office > Word IT Pro Discussions
Comments
Post a Comment