Losing MainDocumentType on Open()
Hi Doug, here it is (this is done through Visual FoxPro):
cExisitngMailMergeTemplate="C:\Path\SomeDocument.d oc"
cMailMergeDataFile="C:\Path\SomeData.csv"
oWord=CREATEOBJECT("Word.Application")
oWord.Documents.OPEN(cExistingMailMergeTemplate)
oWord.ActiveDocument.MailMerge.OpenDataSource(cMai lMergeDataFile)
oWord.Visible=.T.
As soon as you do the OPEN() command is when the MainDocumentType is set to
-1 and then it gets set to 0 after you call OpenDataSource()
Thanks,
Jerry
"Doug Robbins - Word MVP" wrote:
Can you show us the complete code that you are using.
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
"Jerry" wrote in message
...
Hey guys, I have a mail merge document that is set to Directory for the
Main
Document Type. If I close it and manually reopen it, it stays as a
"Directory" document, but if I open it through automation (i.e.
oWord.Documents.Open("C:\SomeDirectory\SomeDirecto ryDocument.doc")) the
oWord.ActiveDocument.MailMerge.MainDocumentType = -1 as soon as you do the
Open() command and then it gets set to 0 once you call the
OpenDataSource().
How can I open the document through automation and keep the document type
that the user originally saved it with?
Thanks for your help,
Jerry
|