We help IT Professionals succeed at work.
Get Started

VBA Coding to open Windows Explorer with a particular location without opening multiple instances of that.

Last Modified: 2020-01-07
This code is great cause I can tell it to open Windows Explorer to a particular location.
The problem with it is it just keeps opening Windows Explorer every time it is ran.

What I want it to do is have it check to see if there is a Windows Explorer already opened with that location and if there is, put the Windows highlight on that particular one.

How may I change the below to do this?

Public Sub OpenWindowsExplorer(sFullFolderPath As String)
On Error GoTo Err_Proc

  Shell "C:\WINDOWS\explorer.exe """ & sFullFolderPath & "", vbNormalFocus

  Exit Sub
  Call LogError_feo(Err, Err.Description, "modCommon @ OpenWindowsExplorer")
  Resume Exit_Proc
End Sub

Open in new window

Watch Question
Mark EdwardsChief Technology Officer
This problem has been solved!
Unlock 3 Answers and 49 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE