Page 1 of 1 1
Topic Options
#76760 - 2003-09-18 07:45 PM Easy one for somebody...How do I close a word file before closing word?
cmarti Offline
Hey THIS is FUN

Registered: 2001-02-26
Posts: 297
Loc: Little Rock, AR
Right now I'm opening word, inserting a file, saving, and exiting word. How do I close the file before exiting out of word?

Here's what I have already. Variables are populated earlier in the script...
code:
$WordDoc = CreateObject('Word.Application')
$AddTemplate = $WordDoc.Documents.Add(E:\Invoices\Templates\$Template.doc)
$WordDoc.Selection.InsertFile($DirectoryPath\$FileToFormat)
$FormattedDoc = SubStr($FileToFormat,1,Len($FileToFormat) -4)
$SaveWordDoc = $WordDoc.ActiveDocument.SaveAs("$SavePath\$FormattedDoc.doc",0)
$WordDoc.Quit(0)


Top
#76761 - 2003-09-18 07:47 PM Re: Easy one for somebody...How do I close a word file before closing word?
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
I am going to take a guess here..
code:
$WordDoc.ActiveDocument.Close

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

Top
#76762 - 2003-09-18 09:17 PM Re: Easy one for somebody...How do I close a word file before closing word?
cmarti Offline
Hey THIS is FUN

Registered: 2001-02-26
Posts: 297
Loc: Little Rock, AR
You're good...that worked perfectly!!! Thank you!!! [Big Grin]

L8tr...

Top
Page 1 of 1 1


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

Who's Online
0 registered and 507 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.051 seconds in which 0.022 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