The code below doesn't wait for the user - it just sends it.
How can I make it wait for the user?
I thought it has to so with this line, but .T. or .F. behaves the same: oWord:ActiveDocument:MailMerge:Execute( .T. ) // Pause:=True
- Code: Select all Expand view RUN
oWord := CREATEOBJECT( "Word.Application" )
oDoc := oWord:Documents:Open( cDocument )
oDoc:MailMerge:MainDocumentType := 0 //wdFormLetters=0 // sets the mail merge main document type
oDoc:MailMerge:EditMainDocument()
oDoc:MailMerge:OpenDataSource( cDatafile ) //"c:\moredata.txt")
oDoc:MailMerge:Destination := 2 //Email
oDoc:MailMerge:SuppressBlankLines := .T.
oDoc:MailMerge:DataSource:FirstRecord := 1 // wdDefaultFirstRecord = 1
oDoc:MailMerge:DataSource:LastRecord := - 16 //wdDefaultLastRecord = -16
oDoc:MailMerge:MailAddressFieldName = "EMAIL"
oDoc:MailMerge:MailSubject = cSubject
oWord:ActiveDocument:MailMerge:Execute( .T. ) // Pause:=True
oDoc:Close( 0 )
oWord:Quit()