problems when calling wsh - script from executable 
Author Message
 problems when calling wsh - script from executable

Hi all out there!

I want to print a word document on various printers. Therefore I have
written a vbs script containing (among others) the lines below. They
work very well when the script is called from the windows command
line, like cscript -nologo <path>\myscript.vbs <doc name> <printer
name>

However if I try to execute the same command line using the c++
command "system" the winword process does not terminate any more. Then
deleting the line ".ActivePrinter = WScript.Arguments(1)" from the
script and hence printing the document always on the default printer I
suddenly get a positive result also with the c++ call.

So why can't I change the ActivePrinter when calling the script from
c++?

Please help me!!!!!

Thanx,
Michael

With objWD
    ' tell word to remain invisible
    .Visible = False
    Err = 0
    ' open the file with the given name
    .Documents.Open docFileName
    If Err <> 0 Then
       .Quit
       WScript.Quit 3
    End If
    Err = 0
    .ActivePrinter = WScript.Arguments(1)
    If Err <> 0 Then
       .Quit
       WScript.Quit 4
    End If
    Err = 0
    .Options.PrintBackground = False
    .ActiveDocument.PrintOut
    If Err <> 0 Then
       .Quit
       WScript.Quit 5
    End If
    .Quit    
End With
WScript.Quit



Mon, 05 Jul 2004 02:07:46 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. WSH calls VBA or VBA calls WSH

2. Calling an executable from an ASP page

3. calling an executable from JScript ?

4. calling an executable file

5. Can you call an server-side command line executable

6. Calling Executable

7. Calling an Executable from command line

8. Calling non-automated executables

9. calling an executable file

10. Calling a wsh script from HTML

11. Calling JavaScript function from WSH script

12. Calling a Client Access Macro from a WSH shell script

 

 
Powered by phpBB® Forum Software