General information
Category:
COM/DCOM and OLE Automation
Environment versions
Network:
Windows 2003 Server
HI Naomi
I tried the following code but it does not work for both the IF as well as the ELSE logic branch and it crash the app.
For the IF branch, may I know what should I use as the object reference instead of loWord?
Your advice very much appreciated
Thanks & Best Regards
if file(lcMergeDoc)
*** Merge Word Doc alraedy exists
DECLARE INTEGER ShellExecute IN Shell32.DLL INTEGER hwnd, ;
STRING @lpOperation, STRING @lpFile, STRING @lpParameters, ;
STRING @lpDirectory, INTEGER nShowCmd
lcParms = ""
lcDir = addbs(toApplication.ProjectDirectory)+'DOCS'
lcFile = alltrim(juststem(tcOutputFileName))+'.DOC'
lcOp = 'open'
lnshow = 3
lnError = ShellExecute(0, @lcop, @lcfile, @lcparms, @lcdir, lnshow)
#DEFINE wdWindowStateMaximize 1
loWord.WindowState = wdWindowStateMaximize
else
*** Merge Word Doc does not exist
loWord = CREATEOBJECT('Word.Basic')
loWord.FileNewDefault
loWord.MailMergeMainDocumentType(0)
loWord.MailMergeOpenDataSource(tcOutputFileName,0,0,1,0,'','',0,'','','','','')
loWord.MailMergeEditMainDocument
if toApplication.lDebug
messagebox('Save Merge Doc as :'+addbs(toApplication.ProjectDirectory)+'docs\'+ALLT(juststem(tcOutputFileName))+'.DOC')
endif
loWord.FileSaveAs(addbs(toApplication.ProjectDirectory)+'DOCS\'+ALLT(juststem(tcOutputFileName))+'.DOC')
loWord.AppMaximize
#DEFINE wdWindowStateMaximize 1
loWord.WindowState = wdWindowStateMaximize
loWord.AppShow
endif
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only