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

Is there any programmatic way to instantiate Windows explorer, and point it
to a path (without using IE)? If so, is it further possible to then select
an item in that instance, showing the user where a particular file is? Any
help would be greatly appreciated.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Open Windows Explorer and select item

This is some code I used to get to a specific path. It may not be exactly
what you want, but you get the idea. I'm not sure if you can add the
filename or not, give it a try and let me know your results

Dim path1 As String, path2 As String
Dim fs As Object
Dim temp as Variant
Set fs = CreateObject("Scripting.FileSystemObject")
path1 = "G:\path1\" & ActiveCell.Value
path2 = "G:\path2\" & ActiveCell.Value
Select Case "True"
Case fs.folderexists(path1)
temp = Shell("EXPLORER.EXE /e,/root," & path1, vbNormalFocus)
Case fs.folderexists(path2)
temp = Shell("EXPLORER.EXE /e,/root," & path2, vbNormalFocus)
Case Else
MsgBox ("Folder " & ActiveCell.Value & " does not exist")
End Select
End Sub

"R Avery" wrote in message
...
Is there any programmatic way to instantiate Windows explorer, and point

it
to a path (without using IE)? If so, is it further possible to then

select
an item in that instance, showing the user where a particular file is?

Any
help would be greatly appreciated.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Open Windows Explorer and select item

Why not use the file open dialog:

chdrive "C"
ChDir "C:\My documents"
fname = Application.GetOpenFileName()

--
Regards,
Tom Ogilvy



R Avery wrote in message
...
Is there any programmatic way to instantiate Windows explorer, and point

it
to a path (without using IE)? If so, is it further possible to then

select
an item in that instance, showing the user where a particular file is?

Any
help would be greatly appreciated.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 220
Default Open Windows Explorer and select item

Thank you for this. It instantiates the windows explorer and goes to the
appropriate directory.
However, is it possible to then select an item in that window to point the
user to the correct document?

The reason i do not want to use file open dialog is that these files will
not be Excel files... they will be a combination of either: PDFs, DOCs,
TXTs, or TIFs.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 220
Default Open Windows Explorer and select item

One more thing. In the SHELL function you gave me, what does the
"\e,\root," do?




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Open Windows Explorer and select item

I would recommend you check out the Microsoft knowledge base at the
following link
http://support.microsoft.com/default...Product=wd2002
watch for word wrap
the article q130510 talks about the command-line switches for explorer. The
/e switch tells explorer to open in explorer view and the /root switch
specifies the root level folder to view. There is a switch /select which
allows sub object selection but I'm not sure if that is just for folders or
allows file also. Give it a try
Paul D

"R Avery" wrote in message
...
One more thing. In the SHELL function you gave me, what does the
"\e,\root," do?




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Open Windows Explorer and select item

Well if I would have read the examples at the bottom I would have seen you
can select a file as per this example

explorer /select,c:\windows\calc.exe

Paul D

"Paul D" wrote in message
...
I would recommend you check out the Microsoft knowledge base at the
following link

http://support.microsoft.com/default...Product=wd2002
watch for word wrap
the article q130510 talks about the command-line switches for explorer.

The
/e switch tells explorer to open in explorer view and the /root switch
specifies the root level folder to view. There is a switch /select which
allows sub object selection but I'm not sure if that is just for folders

or
allows file also. Give it a try
Paul D

"R Avery" wrote in message
...
One more thing. In the SHELL function you gave me, what does the
"\e,\root," do?






  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 220
Default Open Windows Explorer and select item

Perfect! Thank you so much, Paul. ;D


"Paul D" wrote in message
...
Well if I would have read the examples at the bottom I would have seen you
can select a file as per this example

explorer /select,c:\windows\calc.exe

Paul D

"Paul D" wrote in message
...
I would recommend you check out the Microsoft knowledge base at the
following link


http://support.microsoft.com/default...Product=wd2002
watch for word wrap
the article q130510 talks about the command-line switches for explorer.

The
/e switch tells explorer to open in explorer view and the /root switch
specifies the root level folder to view. There is a switch /select

which
allows sub object selection but I'm not sure if that is just for folders

or
allows file also. Give it a try
Paul D

"R Avery" wrote in message
...
One more thing. In the SHELL function you gave me, what does the
"\e,\root," do?








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
Can not open .xls files via Windows Explorer paulmitchell507 Excel Discussion (Misc queries) 3 October 2nd 09 01:40 PM
File Open Vs Opening from Windows Explorer [email protected] Excel Discussion (Misc queries) 0 September 7th 07 10:15 AM
Open Excel 2003 from Windows Explorer pmpjr Excel Discussion (Misc queries) 9 September 11th 06 03:58 PM
Excel files won't open from Windows Explorer AnotherEd Excel Discussion (Misc queries) 3 July 20th 06 09:58 PM
windows explorer will not open an excel spreadsheet. hal Excel Discussion (Misc queries) 2 June 24th 05 02:07 AM


All times are GMT +1. The time now is 01:08 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"