Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Windows Explorer

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Windows Explorer

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" wrote:

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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Windows Explorer

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/libr...88(VS.85).aspx



"Jacob Skaria" wrote:

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" wrote:

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.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default Windows Explorer

The two lines,
Dim retValue
retValue = Shell("C:\Windows\explorer.exe", vbNormalFocus)

will open an instance of Windows Explorer and allow you to navigate the file
system and open or run files as usual but you won't be able to return
information from or control any files that you launch from the Explorer
window (the user can work with them but your VBA routine can't).

Both Office VBA and the Shell.Application make available 'Explorer like'
windows that can be used much like Explorer so your user can select a folder
or file. In these cases, you can return the path and file name and then use
the Shell function or some other means to launch or execute the file in a
way that gives you a bit more control.

Steve Yandl



"Philosophaie" wrote in message
...
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.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Windows Explorer

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

"Steve Yandl" wrote:

The two lines,
Dim retValue
retValue = Shell("C:\Windows\explorer.exe", vbNormalFocus)

will open an instance of Windows Explorer and allow you to navigate the file
system and open or run files as usual but you won't be able to return
information from or control any files that you launch from the Explorer
window (the user can work with them but your VBA routine can't).

Both Office VBA and the Shell.Application make available 'Explorer like'
windows that can be used much like Explorer so your user can select a folder
or file. In these cases, you can return the path and file name and then use
the Shell function or some other means to launch or execute the file in a
way that gives you a bit more control.

Steve Yandl



"Philosophaie" wrote in message
...
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.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 897
Default Windows Explorer

To browse for files, see

http://www.dailydoseofexcel.com/arch...topenfilename/

To run any selected file, see

http://www.codeforexcelandoutlook.co...-from-outlook/

--JP

On Oct 5, 5:40*am, Philosophaie
wrote:
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.


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default Windows Explorer

Joel,

A literal interpretation of the OP's question suggests your modification of
my proposal as the solution the OP was after. However, my hunch is that the
best solution for what the OP really wanted to accomplish is your earlier
post. I offered my solution with Shell launching explorer.exe, just in case
the OP wanted the user to be able to navigate to the correct folder and file
within that folder.

In addition to presenting the user with the ability to navigate the file
system, explorer.exe will read file association information from the
registry and employ the appropriate executable file to launch the selected
file. However, the same could be accomplished creating an instance of the
"WScript.Shell" object and using its 'Run' method. The negative to using
explorer.exe is that you then oblige the user to shut down the process, or
you kill the process using code, or the worst option where you leave a rogue
process running to burden the system until the next reboot. I think the
primary reason for wanting to launch an application using explorer is to
offer the user the interface.

As I pointed out in my earlier post, if the ability to navigate to the file
is what the OP wanted to offer the end user, I think a better choice than
explorer.exe would be something like:
Set fd = Application.FileDialog(msoFileDialogFilePicker)


Steve Yandl



"Joel" wrote in message
...
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

"Steve Yandl" wrote:

The two lines,
Dim retValue
retValue = Shell("C:\Windows\explorer.exe", vbNormalFocus)

will open an instance of Windows Explorer and allow you to navigate the
file
system and open or run files as usual but you won't be able to return
information from or control any files that you launch from the Explorer
window (the user can work with them but your VBA routine can't).

Both Office VBA and the Shell.Application make available 'Explorer like'
windows that can be used much like Explorer so your user can select a
folder
or file. In these cases, you can return the path and file name and then
use
the Shell function or some other means to launch or execute the file in a
way that gives you a bit more control.

Steve Yandl



"Philosophaie" wrote in message
...
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.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows Explorer Launchnet Excel Worksheet Functions 2 June 25th 07 05:57 AM
windows explorer to excel barrfly Excel Discussion (Misc queries) 2 July 27th 05 04:28 PM
Windows Explorer maximizes over XL 2000, if opened w/ explorer bill Excel Discussion (Misc queries) 2 June 28th 05 02:53 PM
Use Windows Script to run Windows Explorer Search? Ian Elliott[_3_] Excel Programming 0 January 12th 04 05:03 PM
Load Windows Explorer raj Excel Programming 3 December 29th 03 10:23 PM


All times are GMT +1. The time now is 09:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"