Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Activating Word Window
Message
From
25/06/2010 22:22:39
Hong Yew
People Quest
Malaysia
 
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01470664
Message ID:
01470675
Views:
38
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
Map
View

Click here to load this message in the networking platform