Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

whatever happened to vba.shell?

Status
Not open for further replies.

osomarron

Programmer
Feb 29, 2004
6
0
0
PE
I used the vba.shell method to create a small app to autorun my divx cds. The commands were like this

x=vba.shell("start k:\vid\special1.avi",vbhide)

I used this app on my pc and other pcs with windows xp and windows 98se without a problem, but lately I had to reinstall my xp from scratch and now every app I used Shell in throws an error 53 - file not found...

I don't know if I need some special dll or something, I searched the web for a solution but everyone talks about shell like it's obsolete or something. The deal is I'm not looking for an alternative way, but a way to get this code to work again, because I already burned over 200 cds with that app. Any ideas?
 
Have you remapped k, it might be better to use the unc path.

"Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'."
 
the command above is an example of how the app builds the command using the App.Path and several strings. I even used the Immediate window to msgbox me the resulting parameter and it is correct in every way, drive, folder and file...

In short terms, it definitely uses a valid path but it throws the error 53.
 

Your problem is that the .avi postscript is not assigned to any application, so the shell command does not know what application to startup to run the .avi file.

Try specifying the application in which to open the avi in the Shell command ie
x=vba.shell("C:\Program Files\...\xxx.exe k:\vid\special1.avi",vbhide)
 
well... my AVIs and M3Us are already assigned to winamp... I even tried the code with JPGs, BMPs, DOCs, TXTs, but none of them worked...

anyway, for a future version of my app, is there a way to retrieve the path of an app assigned to certain file extension? like reading it from a registry key or something?.. so i can include it in the shell code (like Neil's example)?
 
If you want to open a file from it's default application, there is a tidier way using the ShellExecute API. For full details see:

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'
 
>to retrieve the path

Check out the following two API calls:

FindExecutable
AssocQueryString

Examples for both have been provided in this forum, so a keyword search should do the trick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top