To show and select a file in explorer using VBA you can use the following snippet.
This snippet should also work in VB6.
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”
RT @CodeSnippetsNET: Select a file in explorer using #VBA http://t.co/xacI62NCeb #vb6 #vb #programming