View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
isabelle isabelle is offline
external usenet poster
 
Posts: 587
Default Open Windows Explorer from Excel and select specific file

hi Thomas,

another way to do it,


Sub OpenExplorer()
Dim fd As FileDialog
Dim oFile As String
Dim wb1 As Workbook, wb2 As Workbook
Dim sPathName As String

sPathName = "c:\..." 'adapt

ChDir sPathName

Set fd = Application.FileDialog(msoFileDialogFilePicker)

With fd
.AllowMultiSelect = False
.Show
On Error Resume Next
If Err.Number < 0 Then Err.Clear: Exit Sub
oFile = .SelectedItems(1)
End With


Set wb1 = ActiveWorkbook
Set wb2 = Workbooks.Open(oFile)

Windows(wb2.Name).Visible = True

'action

wb2.Close SaveChanges:=True

Set wb1 = Nothing
Set wb2 = Nothing

End Sub



isabelle

Le 2013-01-10 04:50, thomas häger a écrit :
Hi,

I have a collection of documents for overview in an excel sheet and I
would like to be able to click a button to trigger Windows Explorer to
open and for the selected file to be highlighted. I have found a way
to do this for earlier Windows versions but it will not fly with my 64
bit Win7. The articles I find on Microsoft does not seem to help me
much. Any ideas?

Thanks!