Running Other Programs from Excel

Hi, Been really busy both at work, and at home recently so I have not had as much time to blog as I would have liked. Things are still very very very hecktic, but, I’ll try hard to put some posts up… to wit:

You can use the Shell command to run programs on your pc, this code run the windows calulator for eaxmple:

[vba] Sub CallAccessRunTime()

Shell pathName:=”C:\WINDOWS\System32\calc.exe”, _
windowStyle:=3

End Sub[/vba]

The last arugment can be passed the following values:

Value Value (string) Result
1, 5, 9 vbNormalFocus Normal with focus

2 vbMinimizedFocus Minimized with focus

3 vbMaximizedFocus Maximized with focus

4, 8 vbNormalNoFocus Normal without focus

6, 7 vbMinimizedNoFocus Minimized without focus

Comments

  1. Ivan F Moala says:

    Whilst shell is usefule for your own use, I have found the ShellExecuteA API a lot more robust, especially for developing for others.

    Have a look here….

    http://www.xcelfiles.com/shellexecutea.html

  2. ross says:

    Thank for the link Ivan, that does look more poverful.

Submit a Comment