Information générale
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
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
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement