Windows Explorer

  • Thread starter Thread starter Philosophaie
  • Start date Start date
P

Philosophaie

Tell me if this is possible. From Excel Windows API can you open Windows
Explorer, open a select folder, select a file and execute it.
 
If you are looking at executables; check out the help on Shell

Runs an executable program and returns a Variant (Double) representing the
program's task ID if successful, otherwise it returns zero.

Syntax
Shell(pathname[,windowstyle])

' Specifying 1 as the second argument opens the application in
' normal size and gives it the focus.
Dim RetVal
RetVal = Shell("C:\WINDOWS\CALC.EXE", 1) ' Run Calculator.


If this post helps click Yes
 
See the website below. The example is using Notepade.exe but should work for
any application. The problem with using the shell command you have to
specify the entire path of the executable. If you are trying to open a pdf
file you would have to specify the following in the shell command


shell("C:\Program Files\Adobe\Reader 9.0\Reader\acrord32.exe c:\mypadf.pdf")

the problem is the path for the adobe read will be diffferent on different
PCs. At home I have 8.9 and work I have 9.0. When you excute a file from
the window explorer does an association between the file extension and the
application. The shell command won't perform this association automatically.

Website:

http://msdn.microsoft.com/en-us/library/aa389388(VS.85).aspx



Jacob Skaria said:
If you are looking at executables; check out the help on Shell

Runs an executable program and returns a Variant (Double) representing the
program's task ID if successful, otherwise it returns zero.

Syntax
Shell(pathname[,windowstyle])

' Specifying 1 as the second argument opens the application in
' normal size and gives it the focus.
Dim RetVal
RetVal = Shell("C:\WINDOWS\CALC.EXE", 1) ' Run Calculator.


If this post helps click Yes
---------------
Jacob Skaria


Philosophaie said:
Tell me if this is possible. From Excel Windows API can you open Windows
Explorer, open a select folder, select a file and execute it.
 
Steve: I think you gave a great answer but only half the real answer.

Try this instead

retValue = Shell("C:\Windows\explorer.exe c:\temp\test.pdf", vbNormalFocus)

I included the file name to open in the command line and it opens the
application in the explorer window.





I can do it manually and it will open the file, but not sure how to do it
from VBA. If yo udon't know let me know so I can do some futher reasearch.
either send

I think we want to put the file name
 
Back
Top