Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default VBScript from VBA excel / wshShell.Run failed, error 80070483

hi,

i am trying to run a vb script from a VBA module in excel.

fn = "test.vbs
Set wshShell = CreateObject("Wscript.Shell")
wshShell.Run (fn)

in the line wshShell.Run (fn) i obtain an error error 80070483

method Run of object IWshShell3 failed

it is the first time i do this, so i am not shure if i need to have
done something before, some references???

in windows extension .vbs is not related to any application (is it
ok???)

tks in advance

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default VBScript from VBA excel / wshShell.Run failed, error 80070483

Maybe its just the path:

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


works just fine.

--
Gary''s Student - gsnu200730


"rhXX" wrote:

hi,

i am trying to run a vb script from a VBA module in excel.

fn = "test.vbs
Set wshShell = CreateObject("Wscript.Shell")
wshShell.Run (fn)

in the line wshShell.Run (fn) i obtain an error error 80070483

method Run of object IWshShell3 failed

it is the first time i do this, so i am not shure if i need to have
done something before, some references???

in windows extension .vbs is not related to any application (is it
ok???)

tks in advance


  #3   Report Post  
Posted to microsoft.public.excel.programming
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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default VBScript from VBA excel / wshShell.Run failed, error 80070483

Not O.K.
from any folder:
Tools Folder Options File Types
and then register .vbs with the Microsoft (r) Windows Based Script Host
--
Gary''s Student - gsnu200730


"rhXX" wrote:

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


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 284
Default VBScript from VBA excel / wshShell.Run failed, error 80070483

If you're not needing the "WScript.Shell" object for any other reason than
launching your vbs file, you could just use the 'Shell' function within VBA.
Either way, you need to launch either WScript.exe or CScript.exe and pass
the path to your vbs file to the executable as an argument rather than
trying to "run" the vbs file.

Steve Yandl



"rhXX" wrote in message
ups.com...
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





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default VBScript from VBA excel / wshShell.Run failed, error 80070483

If you're not needing the "WScript.Shell" object for any other reason than
launching your vbs file, you could just use the 'Shell' function within VBA.
Either way, you need to launch either WScript.exe or CScript.exe and pass
the path to your vbs file to the executable as an argument rather than
trying to "run" the vbs file.

Steve Yandl


Not O.K.
from any folder:
Tools Folder Options File Types
and then register .vbs with the Microsoft (r) Windows Based Script
Host
--
Gary''s Student - gsnu200730


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!!!

  #7   Report Post  
Posted to microsoft.public.excel.programming
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


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default VBScript from VBA excel / wshShell.Run failed, error 80070483

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

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


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.


urkec


tks urkec, yes i did found a mistake of my first bypass, i wrote
directly to forum and noto copy and paste ...

ok about wshSell.Run and Shell, now they are working ok writting
explicity Wscript.exe

tks a lot for the help!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
IWshRuntimeLibrary.WshShell.SpecialFolders requires a variant argument ion Excel Programming 2 November 16th 06 05:15 PM
Excel 97 error: 'Copy method of range class failed' Linking to specific cells in pivot table Excel Programming 10 July 9th 05 03:19 AM
Wshshell / VB direction question Steve[_58_] Excel Programming 3 May 24th 04 09:20 PM
Error Excel: 1004 SaveAs method of Workbook class failed sebastien Excel Programming 0 August 13th 03 09:59 AM
HELP!! Excel 2000 Copy of worksheet class failed run time Error 1004 Martin[_6_] Excel Programming 1 August 2nd 03 03:16 PM


All times are GMT +1. The time now is 09:26 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"