Page 1 of 1 1
Topic Options
#93072 - 2003-10-07 02:47 PM Word Intergration
cpoyner Offline
Fresh Scripter

Registered: 2002-11-06
Posts: 33
I have a user account creation script as well as a new user template in word. The script of cource creates users, the template uses a macro to print a letter to the user on how to change passwords and such.

Has anyone been able to pass information to VBA macro's in word? Searched high and low here, got any good links?

Thanks in advance

Top
#93073 - 2003-10-07 02:50 PM Re: Word Intergration
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
I know that Shawn has done a bit of automation in Word. How about http://msdn.microsoft.com or http://www.microsoft.com/office ? There maybe some stuff over at at http://cwashington.netreach.net as well.

HTH,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#93074 - 2003-10-07 03:07 PM Re: Word Intergration
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
trash your word sh*t.
just do a nice stuff on on pure text.
sure, you can do it with word but it soooooooo slooooow.

with simple text file you modify the file like you wish.

anyway, if you want to make word to print your stuff, I still would rather use the pure text file and make the template read that in when opened.
_________________________
!

download KiXnet

Top
#93075 - 2003-10-07 03:10 PM Re: Word Intergration
cpoyner Offline
Fresh Scripter

Registered: 2002-11-06
Posts: 33
I was just playign with that thought. But can you bold and do other kidns of formatting in simple text?
Top
#93076 - 2003-10-07 05:09 PM Re: Word Intergration
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
I'm sure this can be done, in fact positive. But you have to decide whether it makes more sense to call a word macro from a Kixscript, and pass arguments, or just simply write a Kixscript that implemented the body the macro itself, think the latter makes more sense.

-Shawn

Top
#93077 - 2003-10-07 05:16 PM Re: Word Intergration
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
and, one thing you could do is make the whole thing with with HTML.
yep, make it html and then print it from the application you wish.
that way the stuff can be lot simpler.
and does not need so much coding.
_________________________
!

download KiXnet

Top
#93078 - 2003-10-07 06:57 PM Re: Word Intergration
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
You could also use the RichText option in KiXforms to create the letter.
_________________________
There are two types of vessels, submarines and targets.

Top
#93079 - 2003-10-07 08:43 PM Re: Word Intergration
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
ja, if it would work [Big Grin]
_________________________
!

download KiXnet

Top
#93080 - 2003-10-07 09:41 PM Re: Word Intergration
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
k, think this will give you some idea.
you need the PrintTo() udf in your script file to be able to use this code.
get it from:
http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=12;t=000360

$tempfile="%temp%\newusernote.htm"
$ourserverroomprinter="\\myDC3\xeroxColor"
$username="theNewUser"
$password="ournewlygeneratedRandomPassWhich1sLongEnoughto_make!the,end-user MAD!"
$myhtml="<H1>dude, you got a nice new user account!<h1><p>your account information is:</p>"+
"<ul><li>username:<font color='red'>"+$newuser+"</font><li>password:<font color='red'>"+$password+"</font></ul>"+
"<p>once you log on the first time, you will be asked to <b>change your password</b> (case sensitive)."+
" this is just security procedure. don't worry about it, just bloody change it, you ignorant end-user!"

del $tempfile ;don't want our tempfile be there yet.
$returncode=open(1,$tempfile,5) ;but we want to create it ourselfes
$returncode=writeline(1,$myhtml)
$returncode=close(1)
PrintTo($tempfile,$ourserverroomprinter) ;ok, let's print it.


to do lots of users, just work in some looping.
k?

[ 07. October 2003, 21:42: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#93081 - 2003-10-07 10:16 PM Re: Word Intergration
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
k, looked at the html-printing engine in IE5 and up.
you can't script the print of html-files [Mad]
it does always bring up the printer dialog.
also, seems that the some SP or patch does something weird as the printTo() didn't worky in my wksta anymore.
_________________________
!

download KiXnet

Top
#93082 - 2003-10-07 10:35 PM Re: Word Intergration
kholm Offline
Korg Regular
*****

Registered: 2000-06-19
Posts: 714
Loc: Randers, Denmark
I see two possible solutions:
  • Write the values you want passed to word to environment variables, and let the word macro read the values from theese. If you create the env. variables with LSET the variables are only temporary. (Not known outside current script)
  • Write your values to an ini-file and then read the values from the word macro.
If you have 'secret' values you should use the LSET method.
-Erik

Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1003 anonymous users online.
Newest Members
StuTheCoder, M_Moore, BeeEm, min_seow, Audio
17884 Registered Users

Generated in 0.061 seconds in which 0.025 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org