MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Open Explorer with VBA Excel to get the directory of a file

Posted by Alan on August 07, 2001 4:41 AM

Hello, I want to open the "Windows Explorer" with a VBA Macro, point a file and get the full name an directory from this file to paste it (like text) into a cells.

Can you help me ?

PS: I've Excel 2000

Posted by Ivan F Moala on August 07, 2001 9:29 PM

Tyr something like this;

Sub Macro2()
Dim FileNm As String

FileNm = Application.GetOpenFilename("All files (*.*),*.*")
If FileNm = "" Then Exit Sub
[a1] = FileNm
End Sub

This places the fule file name & path in A1

Change as required or repost