Re: word automation problem
From: Thomas L (this.is.not.my.email_at_ddress.com)
Date: 03/23/04
- Next message: Kevin Clark: "report form and C5 error"
- Previous message: Fred Taylor: "Re: Close box disappears"
- In reply to: Roger Ansell: "Re: word automation problem"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 23 Mar 2004 17:12:15 +0100
Hi,
thx for testing that. I now asked my customer first to make sure they have
installed all patches from windowsupdate and officeupdate. Maybe they missed
one of those and that caused the problem?
Regards,
Thomas L.
"Roger Ansell" <notmyreal@emailaddress.com> wrote in message
news:c3hh2k$28a42s$1@ID-212432.news.uni-berlin.de...
> Thomas L <this.is.not.my.email@ddress.com> wrote:
> > Hello,
> >
> > in my app i have a piece of code that opens word invisible, makes a
> > new document based on a template, fills in a few fields on the new
> > document and then prints the document. Below i'll paste the commands
> > i'm using for that:
> >
> > useprinter = getprinter()
> > wordApp = createobject('Word.Application')
> > wordApp.visible = .F.
> > wordapp.activeprinter = useprinter
> > wordDoc = wordApp.documents.add(setup.my_template)
> > with wordApp
> > if .ActiveDocument.Bookmarks.Exists("name") then
> > .ActiveDocument.Bookmarks("name").Select
> > .Selection.Text = alltrim(patient.name) + " " +
> > alltrim(patient.firstname) + " - " + alltrim(str(patient.patient_id,
> > 10)) endif
> > if .ActiveDocument.Bookmarks.Exists("address") then
> > .ActiveDocument.Bookmarks("address").Select
> > .Selection.Text = alltrim(patient.address)
> > endif
> > etc ... (i have a few other fields i fill in like that, but that
> > doesn't matter i adress them all in the same way)
> > end with
> > wordapp.printout(1, 0, "0", "", "", "", 0, setup.number_of_copies)
> > Wordapp.ActiveDocument.Close(.F.)
> > do while wordapp.backgroundprintingstatus > 0
> > wait timeout 1
> > enddo
> > wordapp.quit
> > release wordapp
> >
> > that's basically the code i'm using. Just mention that everything
> > between worddoc = wordapp.documents.add(setup.my_template) and do
> > while wordapp.backgroundprintingstatus ... enddo is in a loop that
> > creates a number of documents. But that really can't be the problem i
> > think. I have another user that has over 100 documents created that
> > way and with him this runs just fine.
> >
> > Regards,
> >
> > Thomas L.
>
> Are you able to determine on which line the error is occuring?
> Does your customer get only _one error ("WordApp not found")?
> I've tested your code in VFP6 & Word 2002 and it works fine
> (apart from correcting the "end with" to "endwith").
>
> -Roger
> --
> Roger Ansell
> Adelaide, Australia
>
> My real email address is ransell at senet dot com dot au
>
>
- Next message: Kevin Clark: "report form and C5 error"
- Previous message: Fred Taylor: "Re: Close box disappears"
- In reply to: Roger Ansell: "Re: word automation problem"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|