| Subject |
Re: Print Entryfield Editor |
| From |
Norman Snowden <duluth@msn.com> |
| Date |
Sat, 23 Apr 2022 11:51:33 -0400 |
| Newsgroups |
dbase.getting-started |
Mervyn Bick Wrote:
> On 2022/04/22 19:28, Norman Snowden wrote:
> > Below is part of the code I used to successfully complete Editor2 and show the
> > results on screen. However, I also want to print the results. When I try to print it, an
> > Error message comes up, " Can't find File plot_occupation.txt".
> > I checked in the program Folder and do find plot_occupation.txt there. If clicked on, it prints out with Notepad and can be sent to the printer for printing. Must be something with word. application?
> >
> > I realize the entire code would be necessary to find the problem. However, any comments would be appreciated. Thanks, Norman
> >
> > Asort(Occup,1)
> > form.editor2.value = ''
> > fFile = new file()
> > fFile.create('plot_Occupations.txt')
> > crlf = chr(13)+chr(10)
> > form.editor2.value += " " + crlf
> > form.editor2.value += ' ' + ' OCCUPATIONS' + ' ' + crlf
> > form.editor2.value += " -------------------------------------------------" //no crlf
> > fFile.puts(form.editor2.value) //fFileputs() adds crlf in file automatically
> > form.editor2.value += crlf //add crlf to editor contents for proper display
> >
> > function PUSHBUTTON11_onClick()
> > form.entryfield1.value = set('directory')+'\plot_occupation.txt'
> > oWord = new oleAutoclient("word.application")
> > oWord.ChangeFileOpenDirectory( set('directory')+'\')
> > oWord.documents.open("plot_occupation.txt",false, true )
> > oWord.activeDocument.printOut()
> > oWord.quit( 0 )
> > release object oWord
> > oWord = null
> > return
>
> For some reason oWord.ChangeFileOpenDirectory( set('directory')+'\') is
> not pointing Word to the right place.
>
> Instead of changing the directory, simply adding the path to the
> filename gets around the problem.
>
>
> cFile = set('directory')+'\plant_occupation.txt'
> oWord = new oleAutoclient("word.application")
> // oWord.ChangeFileOpenDirectory( set('directory')+'\')
> oWord.documents.open(cFile,false,true)
> oWord.activeDocument.printOut()
> oWord.quit( 0 )
> release object oWord
> oWord = null
>
>
> Mervyn.
Mervyn, for some reason even with the change, the same error message occurs. It still sends the txt file to the main program folder rather than the word document. It does'nt make sense. I want to thank you for previously showing me how to use the entryfield Editor to write code and the word. application to print. A previous program using that code still runs fine and prints out OK. As stated, I used that code for this new program.
Again, thanks Norman
|
|