PDA

View Full Version : macro to open a folder with explorer



ruler
02-05-2007, 09:59 AM
Hello,

I'm trying to create a Excel 2003 macro which will use vlookup to get the folder name to open with explorer (like a folder d:\123 for excample).
1. As a starting point I created a vlookup formula:
=+HYPERLINK(+VLOOKUP(F7,hyper,2))
2. Next luckily I googled to Open any file or application (author johnske) kb article in this forum.
But appears I can't figure out how to join my formula to it.
'<< OPEN ANYTHING >>
Sub OpenWindowsExplorer()

On Error GoTo 1
ActiveWorkbook.FollowHyperlink "C:\Windows\explorer.exe", NewWindow:=True
Exit Sub
1: MsgBox Err.Description

kb id=341

3. And what is missing in my vlookup formula - there must be a relative lefmost cell in the active row, instead of F7.


Is it possible to create such a macro?

Thanks.
Andres

Bob Phillips
02-05-2007, 10:48 AM
How about Shell



shell "explorer C:\"

ruler
02-07-2007, 04:18 PM
Thanks for trying.
It's still a rather long way to the working macro :-), but perhaps it's better to start from formula, as this site has also rather restricted avilabilty and the content is displayed mostly MSIE users in mind ... :-(

As my macro writing skills are rather poor -

Is it possible in the formula below to replace fixed "F7" with active cell?
Or perhaps even more precisely - to replace F7 with leftmost cell in the present row?

=+HYPERLINK(+VLOOKUP(F7,hyper,2))

Thanks