Jump to content

Working (XP) VBA Code Errors Out In W7


Recommended Posts

I have a working VBA program that was developed for XP. We are starting to upgarde to W7 and one of the users ran my program and received the error "Run-time error '-2147024893 (80070003)': Method 'Run' of object 'IWshShell3' failed"

The code that created the error:

Set objShell = CreateObject("WScript.Shell")

objShell.Run "N:\Shared\TOandPGI\TOCounter.vbs"

Thanks in advance for any help - Mike

Link to comment
Share on other sites


have you thought of changing the code to read

Set objShell = CreateObject("WScript.Shell")
objShell.Run Chr(34) & "N:\Shared\TOandPGI\TOCounter.vbs" & Chr(34)

The error code I think means The system cannot find the path specified. therefore if the additional double quotes doesn't work then I'd suggest you check that the path is actually correct, (most likely an incorrect shared drive letter).

Link to comment
Share on other sites

You could try this VBS script.

1:\ Checks For File Exists

2:\ If Missing Error Mesage

3:\ If Exists It Should Run The File.


'-> Path To File
Dim File :File="N:\Shared\TOandPGI\TOCounter.vbs"
'-> Check Before We Run
If CreateObject("Scripting.FileSystemObject").FileExists(File) Then
CreateObject("Wscript.Shell").Run(Chr(34) & File & Chr(34)),1,True
Else
MsgBox "Error Can Not Find This File" & vbCrLf & _
File,4128,"Error Missing File"
End If

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...