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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shell command not working on some computers?

Status
Not open for further replies.

JoshLindenmuth

IS-IT--Management
Sep 20, 2007
3
US
I feel like I'm losing my mind here. I have a simple subroutine in Excel 2003, and on some computers it works, on others it doesn't:

Code Snippet
Sub test()
retval = Shell("c:\windows\notepad.exe", vbMaximizedFocus)
MsgBox retval
End Sub

In particular, ALL the computers at work do nothing (retval = 0 with no program launched), while my home computers return the process ID and launch notepad, as expected. I've verified that all the computers have notepad.exe in the c:\windows\ folder and both sets of computers experience the same behavior for other programs.

Thanks in advance,
Josh
 
Are you sure the path c:\windows\notepad.exe exists on the computers at work? At my workplace, there is no c:\windows. We run Windows2000 and notepad.exe is in c:\winnt.

_________________
Bob Rashkin
 
Yes, I'm 100% sure (sitting at my work computer now). Last night I ran the following test commands at home - all of them worked, but none did anything here at work:
Shell "notepad.exe"
Shell "cmd.exe"
Shell "start cmd.exe"
Shell "start test.pdf"
Shell "import.bat c:\eetemp.dat"
Shell "c:\import.bat c:\eetemp.dat"

The last shell command is the one I'm really interested in, but I list all the others because none are working on our work computers.

Thanks,
Josh
 
SOLVED IT!

We use Kaspersky Anti-Virus, which was blocking the Shell command for some reason.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top