Consulting

Results 1 to 3 of 3

Thread: Shell Cmd Works on Some Computers, But Not Others

  1. #1
    VBAX Regular
    Joined
    Oct 2010
    Posts
    85
    Location

    Shell Cmd Works on Some Computers, But Not Others

    On some computers/companies, the shell command will not run.

    I am using this code, but have used other approaches to call a windows command shell:
    http://www.cpearson.com/excel/ShellAndWait.aspx

    It stops here, which may give an better idea about why it won't run the command shell:

    ProcHandle = OpenProcess(SYNCHRONIZE, False, TaskID)
    If ProcHandle = 0 Then
    ShellAndWait = ShellAndWaitResult.Failure
    Exit Function
    End If


    My best guess is that this computer system/company has incorporated something that restricts Excel VBA from actually running the shell command. Perhaps this is set by IT or anti-virus, etc.? I suppose this might be a security measure/setting?

  2. #2
    VBAX Master austenr's Avatar
    Joined
    Sep 2004
    Location
    Maine
    Posts
    2,033
    Location
    Your probably right. Depends on the security the company has set up. Companies are getting very aware of stuff that they dont know that might compromise their systems.

    BTW, you say it runs on some computers but not others. Do you mean some companies and not others. If thats the case then your suspicions are most likely correct.
    Peace of mind is found in some of the strangest places.

  3. #3
    VBAX Regular
    Joined
    Oct 2010
    Posts
    85
    Location
    Yes, I should be more careful and say that it is company specific, not user specific within a company.

    I can see how a company might want to restrict access since one could write a malicious shell command (i.e. delete the c: drive) and they probably want to protect against this.

    What can be done to at least understand the problem and perhaps direct the user for a way to disable it. I suppose this may be more of an IT question than a direct VBA question. This could be quite a sticking point.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •