I am writing some code in Java that launches a VBScript to initiate
printing of selected files. Rather than write a custom bit of VB for
each known application, I decided to use the ShellExecute function.
The problem is, this works on my development machine (Win2K), but I
cant get it to work on XP Home, XP Pro (SP1) or XP Home (SP2).
STRANGELY, if I try to launch anything other than .doc, .ppt, .xls it
seems to work! - Thanks Microsoft! ;-)
Any suggestions? I dont think I can use the 'run' alternative, as that
doesn't allow me to specify the 'print' parameter.
FYI, typing test.doc in DOS or in the 'start->run' section DOES launch
word, so I know the associations are ok.
ATTEMPT 1:
dim objShell, filesys, manifestFile, filetext
set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "C:\test.doc", "", "", "print", 1
set objShell = nothing
ATTEMPT 2:
dim objShell, filesys, manifestFile, filetext
set objShell = CreateObject("Shell.Application")
CreateObject("Shell.Application")_
.Namespace(0)_
.ParseName("C:\test.doc")_
.InvokeVerb "&Print"
set objShell = nothing