Hi,
I have the same code as in the FAQ to print labels from VFP 7.0. This works fine in a windows 2000 computer with Microsoft Word 2002 installed.
When I try it in a Windows XP with Microsoft Word 2003, it doesn't print the document at all and it doesn't give me an error either.
I've looked in many newsgroups with no luck. Thanks in advance,
Monica
#DEFINE wdMainDocumentOnly 1
#DEFINE wdMainAndDataSource 2
#DEFINE wdSendToPrinter 1
#DEFINE wdDoNotSaveChanges 0
#DEFINE wdWindowStateMinimize 2
oWord = CREATEOBJECT("Word.Application")
oWord.Visible = .f.
oWord.WindowState = wdWindowStateMinimize
** change the path and file name to suit
oWord.Documents.Open("&cgetfile")
** check to make sure the documnet is attached to a
** datasource and ready to merge.
If oWord.ActiveDocument.MailMerge.State = wdMainAndDataSource
oWord.ActiveDocument.MailMerge.Destination = wdSendToPrinter
oWord.ActiveDocument.MailMerge.DataSource.FirstRecord = 1
oWord.ActiveDocument.MailMerge.DataSource.LastRecord = -16
oWord.ActiveDocument.MailMerge.Execute
endif
oWord.Quit(wdDoNotSaveChanges) && close file no save
release oWord
I have the same code as in the FAQ to print labels from VFP 7.0. This works fine in a windows 2000 computer with Microsoft Word 2002 installed.
When I try it in a Windows XP with Microsoft Word 2003, it doesn't print the document at all and it doesn't give me an error either.
I've looked in many newsgroups with no luck. Thanks in advance,
Monica
#DEFINE wdMainDocumentOnly 1
#DEFINE wdMainAndDataSource 2
#DEFINE wdSendToPrinter 1
#DEFINE wdDoNotSaveChanges 0
#DEFINE wdWindowStateMinimize 2
oWord = CREATEOBJECT("Word.Application")
oWord.Visible = .f.
oWord.WindowState = wdWindowStateMinimize
** change the path and file name to suit
oWord.Documents.Open("&cgetfile")
** check to make sure the documnet is attached to a
** datasource and ready to merge.
If oWord.ActiveDocument.MailMerge.State = wdMainAndDataSource
oWord.ActiveDocument.MailMerge.Destination = wdSendToPrinter
oWord.ActiveDocument.MailMerge.DataSource.FirstRecord = 1
oWord.ActiveDocument.MailMerge.DataSource.LastRecord = -16
oWord.ActiveDocument.MailMerge.Execute
endif
oWord.Quit(wdDoNotSaveChanges) && close file no save
release oWord