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

Here's a macro to open the folder of the current worksheet, highlighting the
current file (handy if assigned to a toolbar button to open the folder of a
file picked from the Recent Files menu):

Sub OpenCurrentFolder()
On Error Resume Next
Dim CurFold As String
Dim CurFile As String

CurFold = Application.ActiveWorkbook.Path
CurFile = Application.ActiveWorkbook.Name

Call Shell("c:\windows\explorer.exe /e, " & CurFold & ",/select," _
& CurFold & "\" & CurFile, vbNormalFocus)

End Sub

"Brettjg" wrote in message
...
Can I open a folder with VB code, without using a hyperlink? Regards,
Brett