pgrootenhuis
7th August 2003, 10:14
Hi,

I'm wondering if anyone can help me:
I start up a MS Word document from a Baan report.
I do it like this: I print to a file (ASCIF) and fill in on the argument line: 'RTF:"N:\Letter.doc" '. This works great, Word automaticly starts up and opens the document, but now I want to use another letter from a different Baan report.
Is it possible to replace 'Letter.doc' with a variable (Perhaps like %s of something like that) and where and how do I declare that variable?? Or do I have to create a new device for each document ? At this time I don't have that many documents, but there will be more...
I know about the B2Win programs, but I am curious if this also can work (with a variable)

Greetz,

Peter.
;)

lakoon
7th August 2003, 11:25
Hi,

just put %s instead of your filename. If the users prints to the device he can provide his own filename.

pgrootenhuis
7th August 2003, 12:31
Hi lakoon,

This option doesn't work for me. When I use the %s, and allow the user to modify the outputname, a message is returned that the user has no permission to create the file.
I forgot to mention that in 'N:\Letter.doc', the 'N' is my drive on a WINNT4.0 Share. the user has full rights there, but my guess is that %s and the output filename, are being (or tried to be) written on my UNIX system, that won't do.

:o Here's my problem:

I want to print a report in Word, because my boss wants me to to use an own report with own margins, own fonts etc. That, I can do in Word.
In my reportscript I create an ASCII file and with a server2client command I can copy this file from UNIX to a share om my WINNT share (The local PC has a route to this share for drive "N:" )
When I put 'RTF: "N:\Letter.doc" ' as my argument, Word starts up with my Letter.doc and automaticly starts to merge with my ASCII file which I copied to here in my script. The Macro I use in Word is for this letter only, so it won't affect my normal use wih Word.
Now I want to have a new report from another session in Baan, obviously with another name. Now I can create another Device with argument: 'RTF: "N:\Letter2.doc" ' but then I would have to create more and more devices as the list of customized reports grows. The user has to browse through an immense list of devices, things my users and I don't want to do.
Therefore I want to name my report in the script (variable) and use this variable in my argument, so I can use one device for more letters.

Another option is to use a blank letter with a macro witch filters out what letter to use (depends on company for the header or the name of the letter...) Therfore I need to put the companynumber in my ASCII file and also a name of the letter.
I'v recently posted a thread how to get my Companynumber in variable (http://www.baanboard.com/baanboard/showthread.php?s=&threadid=12451) this is going okay, I get my companynumber in Word.
For using these fields in the Word macro I have posted to another forum for Visual Basic questions (Visual Basic Forum (http://www.visualbasicforum.com/)).

There, that's my case, maybe this lightens things up and helps you to understand what I mean with my problem. I don't know if this thing with my variable can be achieved in Baan, but who knows ?

Greetz,

Peter.
Be :cool:

baanlover
7th August 2003, 13:47
Create a device called WORD with the details given below

Device : WORD
Device Type : Rewrite File
4Gl Program : ttstpconv
arg : rtf:winword.exe
path : {$BSE}/tmp/test.doc
page length : 66

Select the device word while printing the data and continue, it will open the o/p in word doc and then u can save the same with a different name in the local client pc. Here every time u select WORD device, it overwrites the existing file test.doc in tmp folder and can be saved in the local pc with a diff name.
Hope it will help you.

rgds,
BL

pgrootenhuis
7th August 2003, 14:19
Sorry, that won't do because I've got existing Word documents on my local PC (actually my WINNT network drive).
Renaming the Test.doc won't help, because there will be too many actions for the user.
My existing documents contain Word Macro's which automaticly start to merge my ASCII file. My Letter.doc works fine now, including the merge to a new document without me interferring, so: in Baan I print my report to Word, then my complete enddocumet with x-number of pages comes out (merged).
The problem is that I want to control from my reportscript or my argument which Worddocument (with own macro's and layout) has to be opened. That is not the case when I create one Temp.doc (no macro's) and manually have to store it elsewhere (local or WINNT drive) and add and activate macro's for merge (select the mergesource, define fields etc.)
But thanks anyway!

P. :(

lakoon
7th August 2003, 15:23
Peter,

why do you go over the print session? can't you start word directly from your script?

Like
1. you copy the file you mentioned to the NT Share
2. you start word from the script with the file you need (app_start).
3. print the dokument from word.

pgrootenhuis
7th August 2003, 16:33
Thank you Lakoon!

This works even better! Now I can choose my letterxxx.doc from the script and print to the standard word-device...

Thanks a lot, this had been puzzling me for several months now.

Regards,

Peter.
:) :) :)