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

On Jun 17, 3:37 pm, Gary''s Student
wrote:
Maybe its just the path:

Sub samples()
fn = "C:\hithere.vbs"
Set wshShell = CreateObject("Wscript.Shell")
wshShell.Run (fn)
End Sub

works just fine.


tks, but i think there is other problem

my sub is:

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

Set fsoFile = fso.CreateTextFile(fn)
fsoFile.WriteLine "Set 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 (fn)

End Sub

the bypass file was created ok:

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

the error is in the line

wshShell.Run (fn)

and the file toto.txt, wich must be created by the vbscript was not
created

question: when i try to run the vbscript by hand, it does not run
because .vbs extension is NOT associated by any application. is this
ok????

tks in advance