Determine if windows explorer is open

N

Nick X

Hi all,
The following code checks for a directory(s), if it doesn't exist it is
created. The directory is then opened. My question is: how do I check to
see if Windows explorer is already open and use the existing instance to show
the path currently being opened:

Dim strBasePath, strSecPath As String
strBasePath = "\FolderA\"

If Len(Dir(CurrentProject.Path & strBasePath & cboAddress, vbDirectory))
= 0 Then 'check for address folder
If Len(Dir(CurrentProject.Path & strBasePath, vbDirectory)) = 0 Then
'check for root folder
MkDir CurrentProject.Path & strBasePath 'create root folder
MkDir CurrentProject.Path & strBasePath & cboAddress 'create
address folder
MsgBox "The directory: " & CurrentProject.Path & strBasePath & "
has been created!", vbInformation, "Test"
Application.FollowHyperlink CurrentProject.Path & strBasePath &
cboAddress 'open address folder
Else
MkDir CurrentProject.Path & strBasePath & cboAddress 'create
address folder
MsgBox "The directory: " & CurrentProject.Path & strBasePath &
cboAddress & " has been created!", vbInformation, "Test"
Application.FollowHyperlink CurrentProject.Path & strBasePath &
cboAddress 'open address folder
End If
Else
MsgBox "The directory: " & CurrentProject.Path & strBasePath &
cboAddress & " already exists!", vbInformation, "Test"
Application.FollowHyperlink CurrentProject.Path & strBasePath &
cboAddress 'open address folder

End If

in other words, I don't want the user to have to deal with multiple explorer
windows cascading down their screen.

Thanks,
Nick
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top