Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Activating Word Window
Message
De
25/06/2010 22:22:39
Hong Yew
People Quest
Malaisie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01470664
Message ID:
01470675
Vues:
39
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
Fil
Voir

Click here to load this message in the networking platform