GetObject creates Word -- controlling visibility of Office applications 
Author Message
 GetObject creates Word -- controlling visibility of Office applications

Hi!
    I have this application that shuffles Word documents around. Whenever it
runs out of memory or I open a document, Word becomes visible, and I get to
see the various documents being opened, built and closed.
    I was thinking jscript would be an excellent way of making word
invisible again, but this script...
try{
 var wd = WScript.GetObject("","Word.Application");
 wd.Visible = false;

Quote:
} catch (e){
 WSHShell.popup(e);
}

just ain't working. It creates a new, invisible copy of Word, which is not
what I want.
    How do I use JScript to make the Word window go away? Can I?
ion


Sat, 02 Jun 2001 03:00:00 GMT  
 GetObject creates Word -- controlling visibility of Office applications


Quote:
>Hi!
>    I was thinking jscript would be an excellent way of making word
>invisible again, but this script...
>try{
> var wd = WScript.GetObject("","Word.Application");
> wd.Visible = false;
>} catch (e){
> WSHShell.popup(e);
>}

>just ain't working. It creates a new, invisible copy of Word, which is not
>what I want.
>    How do I use JScript to make the Word window go away? Can I?
>ion

Try *omitting* the first argument in the GetObject call, rather than
supplying a blank filename. Thus:

var wd = WScript.GetObject(,"Word.Application");

This should return the existing Word object rather than creating a new one.

Christopher Bradford
Member, Team Allaire
Alive! Online Web Development & Consulting



Sun, 03 Jun 2001 03:00:00 GMT  
 GetObject creates Word -- controlling visibility of Office applications
Christopher,
    Thanks for your help. Omitting an argument gives me a syntax error.
Putting in null gives me an [object error] exception, out of which I do not
know how to get information.
ion

begin 666 HideOffice.js



M/2!F86QS93L-"GT-"F-A=&-H*&4I>PT*"5=38W)I<'0N16-H;RAE+G1O4W1R
M:6YG*"DI.PT*?0T*=')Y>PT*"79A<B!O8FI71" ](%=38W)I<'0N1V5T3V)J
M96-T*&YU;&PL(")7;W)D+D%P<&QI8V%T:6]N(BD[#0H);V)J5T0N5FES:6)L

,=')I;F<H*2D[#0I]
`
end



Sun, 03 Jun 2001 03:00:00 GMT  
 GetObject creates Word -- controlling visibility of Office applications
The pathname parameter is optional. Try creating the object thusly:

var wd = Wscript.GetObject("Word.Application")

Trev



Quote:
>Christopher,
>    Thanks for your help. Omitting an argument gives me a syntax error.
>Putting in null gives me an [object error] exception, out of which I do not
>know how to get information.
>ion



Wed, 06 Jun 2001 03:00:00 GMT  
 GetObject creates Word -- controlling visibility of Office applications
Trevor,
    Again, this is JScript, and I get a Syntax error. Thanks for your help,
but I've given up.
ion

...if you don't believe me, try taking the commas out of:
*****
var WSHShell = WScript.CreateObject("Wscript.Shell");
try{
 var objXL = WScript.GetObject(,"Excel.Application");
 objXL.Visible = true;
 objXL.Workbooks.Add().Close();
Quote:
}

catch(e){
 WSHShell.popup(e.toString());
Quote:
}

try{
 var objWD = WScript.GetObject(,"Word.Application");
 objWD.Visible = true;
Quote:
}

catch(e){
 WSHShell.popup(e.toString());

Quote:
}

*****
Quote:

>The pathname parameter is optional. Try creating the object thusly:

>var wd = Wscript.GetObject("Word.Application")



Sat, 16 Jun 2001 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Adding Forms and external code to Word / Office applications

2. GetObject(, "Word.Application")

3. Creating Office Applications

4. Cannot create object Word.Application

5. Cant create ActiveX word.application

6. Create instance of Word.Application

7. A button visibility or disable property control

8. Exiting Office application whilst printing in background.

9. Using RegRead to get version of Office Applications

10. Exiting Office application whilst printing in background.

11. Exiting Office application whilst printing in background.

12. Excel.Application & Office Installed

 

 
Powered by phpBB® Forum Software