View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Brettjg Brettjg is offline
external usenet poster
 
Posts: 295
Default Opening a folder with VB

To all who replied: thanks for your reply, but I'm not getting any closer to
a solution. It seems that I have a bit of a nasty problem here.

This formula works (and has always worked):
=HYPERLINK("C:\2. SETTLED CLIENTS","SETTLED Folder")

This formula used to work, but no longer does:
=HYPERLINK("C:\2. SETTLED CLIENTS\Coad, K","Coad, K")

It gives me a msg of "The path "K" does not exist or is not a directory.
This is patently not the case because I can open it from the 2. settled
clients folder.

So I tried Chip's code, but that gives the same error, but it works on the
main folder (although it doesn't bring the window to the front). This is not
a problem with VB code or Excel formulas, and nothing has changed on those
ares, whatsoever.

It doesn't matter which way I try to open the folder (macro or =hyperlink)
it gives the same error, where it's truncating the path to the last letter. I
know that I don't need a "\" after the last foldername character (because
then it just says that "K\" doesn't exist).

What could possibly cause that? In the folders options I tried to create a
new action called Explore and may have inadvertently left the " on either
side of "C:\Windows\explorer.exe" (the danger of cut and paste). I am not
allowed to edit this action and nor can I delete now. If this was the cause
then why does it not happen on other folders?

As you can probably tell, I'm at my wit's end because I can't function
properly with my client's folders.

Thankyou all for your help thus far.


"Jacob Skaria" wrote:

Hi Dear

In addition to the FSO (FileSystemObject) mentioned by Nigel you may use

DIR function available in VBA. Refer below link
(http://www.techonthenet.com/excel/formulas/dir.php)

OR

If you mean to open the folder in explorer(since you mentioned about
hyperlink);
you can use the below code:

Shell "explorer.exe c:\temp"
(change the folder)


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