View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
urkec urkec is offline
external usenet poster
 
Posts: 131
Default VBScript from VBA excel / wshShell.Run failed, error 80070483

"rhXX" wrote:

gary / steve, tks a lot!

gary after i sent the mail, i tested to register .vbs with some
program, i found .vbe, and i done "an equivalent not encoced"

VBScript Script File
open: C:\WINDOWS\System32\WScript.exe "%1" %*

and worked fine!

i will check Microsoft (r) Windows Based Script Host

steve, i like more ur method, so is indepent from any previus
register. i will check now

tks again to all!!!



I think you also have a problem with your bypass.vbs. It should look
something like this:

Set fso = CreateObject ("Scripting.FileSystemObject")
Set fsoFile = fso.CreateTextFile("c:\tmp\toto.txt")
fsoFile.WriteLine "Hello world"
fsoFile.Close

So your sub could look like this:

Sub bypass()

fn = "c:\tmp\bypass.vbs"
Set fso = CreateObject("Scripting.FileSystemObject")

Set fsoFile = fso.CreateTextFile(fn)
fsoFile.WriteLine "Set fso = CreateObject (""Scripting.FileSystemObject"")"
fsoFile.WriteLine "Set fsoFile = fso.CreateTextFile(""c:\tmp\toto.txt"")"
fsoFile.WriteLine "fsoFile.WriteLine ""Hello world"""
fsoFile.WriteLine "fsoFile.Close"

fsoFile.Close

'Set wshShell = CreateObject("Wscript.Shell")
'wshShell.Run ("C:\WINDOWS\system32\Wscript.exe " & fn)

Shell "C:\WINDOWS\system32\Wscript.exe " & fn, vbHide

End Sub

Both wshShell.Run and Shell will do if you pass in the name of the
executable (in my case "C:\WINDOWS\system32\Wscript.exe ") followed by the
script name ("c:\tmp\bypass.vbs"). If you register .vbs file type to be
opened by WSH executable you can use wshShell.Run (fn) without having to
specify the name of the WSH executable.

Hope this is of some help.

--
urkec