To show and select a file in explorer using VBA you can use the following snippet.
This snippet should also work in VB6.

Sample VBA

Dim path As String
Dim explorerPath As String
Dim cmd As String

explorerPath = Environ$("WINDIR") + "\Explorer.exe "
path = "C:\Users\Codesnippets\Desktop\test\Test.xml"
cmd = explorerPath + " /select , " + Chr(34) + path + Chr(34)
Call Shell(cmd, vbNormalFocus)

One thought on “How to show and select a file in explorer using VBA”

Leave a Reply