#91572 - 2003-02-21 08:38 PM
COM and WORD
|
Tedd Webb
Lurker
Registered: 2003-02-21
Posts: 2
Loc: Orange, California
|
HELP!
We need a quick way to update the workgroup template path for MS Word via KiXstart.
We have Office 97, 2000 and XP, so we would rather not have to go through all the various registry keys to check the version of office. Instead, we have a VBScript that automatically updates the Workgroup Templates path. This code works fine in VBA, VB, and VBScript. However, when it was ported to KiXstart, it does not work. No errors are produced, but the code does not change the workgroup template path.
HELP!
;VBScript Syntax works 100% ;Set wrd = CreateObject("Word.Application") ;wrd.Visible = False ;wrd.Options.DefaultFilePath(3) = "\\Procom2\wab\Tech Serv\" ;wrd.Quit ;Set wrd = Nothing
;Corresponding KiXstart code does not work. ;WHY? Undocumented/missing syntax or bug or what? $wrd = CreateObject("Word.Application") ? ''+@ERROR+' - '+@SERROR ;returns "The Operation Completed Successfully" $wrd.Visible = 0 $wrd.Options.DefaultFilePath(3) = "\\Procom2\wab\Tech Serv\" ? ''+@ERROR+' - '+@SERROR ;returns "The Operation Completed Successfully" $wrd.Quit $wrd = 0
|
|
Top
|
|
|
|
#91573 - 2003-02-22 12:18 AM
Re: COM and WORD
|
Shawn
Administrator
   
Registered: 1999-08-13
Posts: 8611
|
Hi Tedd, welcome to KORG
In short - this particular "flavor" of COM syntax is not supported in Kixtart. I asked Ruud about this a while back, heres a copy of the note:
quote:
Ruud, Just been scratching my head over another COM problem ... think this has been a problem since day one ... just that its not used too often ... This works ok (see it all the time in Excel COM) : $object.property("parm").value = 1 but this does not work: $object.property("parm") = 1 that is to say, a property with parms that is NOT nested ... seems to do a GET_PROPERTY first, than does a BAD PUT_PROPERTY ... again, component tested with VB/VBS and verified ok ... 4.02 has idential behavior. -Shawn
Ruud replied:
Well, as you know, I dropped puts of default properties, so the second example will never work. The GetProperty you are seeing is for the IDispatch interface of '.property("parm")'. The failed put occurs when KiX tries to write to '.property("parm")'. I know VB supports this kind of code, but at the cost of the SET command. Without a SET command, there is no way to tell what you want code like this to do. --Ruud
No consolation here but at least an explaination - not supported.
-Shawn
|
|
Top
|
|
|
|
#91574 - 2003-02-26 07:35 PM
Re: COM and WORD
|
Tedd Webb
Lurker
Registered: 2003-02-21
Posts: 2
Loc: Orange, California
|
Thanks for the info. I guess we'll have to start looking into another login scripting program then because we are starting to implement this style of syntax commands more often.
Oh, well!
Thanks,
Tedd
|
|
Top
|
|
|
|
#91577 - 2005-11-21 07:22 PM
Re: COM and WORD
|
mactune
Just in Town
Registered: 2005-04-25
Posts: 4
Loc: Orlando Florida
|
I am interested in reading/setting the file location in word
I found this the following script here: scripting guy
Code:
Const wdUserTemplatesPath = 2 Const wdWorkgroupTemplatesPath = 3
Set objWord = CreateObject("Word.Application") Set objOptions = objWord.Options
objOptions.DefaultFilePath(wdUserTemplatesPath) = "C:\Templates" objOptions.DefaultFilePath(wdWorkgroupTemplatesPath) = "C:\Workgroup\Templates"
objWord.Quit
-- this is what i came up with for reading the parameters- but it doesn't return anything. i know i'm missing something .... any ideas? Code:
$objWord = CreateObject("word.Application") $objOptions = $objWord.Options $objPath = $objOptions.DefaultFilePath For Each $obj in $objPath ? "$obj" Next
|
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 476 anonymous users online.
|
|
|