Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Office 2007 breaks word Automation
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01331039
Message ID:
01331165
Views:
26
Is sData a file? May be you can try to check if it's opened with fopen and fclose functions?

>Here is the code:
>before this I have cleared the data and header docs;
>then I create a headersource and datasource using the same docs;
>The I merge the header and data docs with the output doc as below;
>
>LPARAMETERS oMemoDoc,sHeader,sData,cGrpId
>ASSERT VARTYPE(oMemoDoc)#'O' MESSAGE "Developer stop at MemoDoc for testing"
>
>LOCAL oMergedDocument
>* word app reference for mailmerge
>oWordApp = oMemoDoc.application
>APPLICATION.OLERequestPendingTimeout = 0   && 0 means no busy error message
>* make sure the merged document is selected
>oMemoDoc.select()
>*WAIT WINDOW "Before open header, data source"
>* attach header & data source to document
>oMemoDoc.MailMerge.OpenHeaderSource(sHeader)
>
>Next line is where I get "File in Use"
>
>oMemoDoc.MailMerge.OpenDataSource(sData)
>*WAIT WINDOW "header and data source open"+sHeader+', '+sData
>* Perform the mail merge
>oMemoDoc.MailMerge.Execute()
>
>* reference the merged document prior to printing
>oMergedDocument = oWordApp.ActiveDocument
>*WAIT WINDOW "Active Doc printing"+(oApp.UserPath+cGrpId+".doc")
>
>* save merged result
>IF LOWER(SUBSTR(oMemoDoc.name,RAT('_',oMemoDoc.name)+1,2)) = "pn"
>	oMergedDocument.SaveAs(oApp.UserPath+cGrpId+"Lst.doc")
>*	WAIT WINDOW "Doc saved"+(oApp.UserPath+cGrpId+"Lst.doc")
>ENDIF
>
>* print merged result
>oMergedDocument.PrintOut(.T.)
>wait "" timeout 5
>
>
>>>John, are you using the code from the Office automation book?. I am using oWord=createobject("word.application",9). Should I be using winWord.application? I get an error "class definition not found" when used.
>>>Chuck
>>
>>I didn't have any troubles with Office 2007.
>>BTW what is 9 passed as second parameter to CREATEOBJECT()?
>>Could you post the code that gives you troubles?
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform