bitaoo
asked on
A problem in <oShell.Run>
Hello friends,
The following is my code. oShell.Run returns an error
<Method 'Run' of object 'IWshShell3' failed', I think
it is because there is a blank in "My Directory" ,
do you know how can I solve it?
sub main()
Dim oShell As Object
Dim nRet As Long
Set oShell = CreateObject("WSCript.shel l")
nRet = oShell.Run("C:\My Directory\RMS.exe", , False)
Set oShell = Nothing
end sub
Thanks,
--Bita
The following is my code. oShell.Run returns an error
<Method 'Run' of object 'IWshShell3' failed', I think
it is because there is a blank in "My Directory" ,
do you know how can I solve it?
sub main()
Dim oShell As Object
Dim nRet As Long
Set oShell = CreateObject("WSCript.shel
nRet = oShell.Run("C:\My Directory\RMS.exe", , False)
Set oShell = Nothing
end sub
Thanks,
--Bita
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank for your response but the problem is because of
blank between "My" and "Directory. How can I solve that?
Thanks,
--Bita
blank between "My" and "Directory. How can I solve that?
Thanks,
--Bita
appari already give you solution. Use GetShortPathName function
ASKER
Thanks a lot.
l=GetShortPathName("C:\My Directory\RMS.exe", x, l)
with
l=GetShortPathName("C:\My Directory\RMS.exe", x, 254)