Skip to content

Instantly share code, notes, and snippets.

@joehanna
Created March 30, 2015 23:42
Show Gist options
  • Save joehanna/79b1842f4516570fd3cc to your computer and use it in GitHub Desktop.
Save joehanna/79b1842f4516570fd3cc to your computer and use it in GitHub Desktop.
VBA: Open Windows Explorer with a specific file selected
Dim fileName as String
fileName = "C:\Windows\notepad.exe"
Shell "explorer.exe /e,/select," & fileName, vbNormalFocus
@apsis0215
Copy link

apsis0215 commented Jan 18, 2023

In excel 2016+

Dim Filepath as string
VBA.Shell "C:\windows\explorer.exe /select, " & "" & filepath & "", vbNormalFocus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment