Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mailmerge document doesn't print in Windows XP

Status
Not open for further replies.

mfong75

Programmer
Apr 22, 2003
7
US
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
 

This post would have being better in forum1251, but I think the problem is with
Code:
 oWord.ActiveDocument.MailMerge.Destination = wdSendToPrinter


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Hi Mike,
Thank you for your response. I'll post it in that Forum, but can you tell me what is wrong with that code?

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top