Open Windows Exporer

*Pete*

Registered User.
Local time
Today, 10:55
Joined
Jul 17, 2006
Messages
40
Hello,

I'm using the following code to create folders, which seems to work fine.

Code:
Private Sub CmdCreateAreas_Click()
strDirectoryPath1 = DLookup("Centre_DataLocation", "T_CentreDetails") & "\Files\Students Files\Stored Assessments\" & [MainFolder]

    MkDir (strDirectoryPath1)

End Sub

What i would like to do however is have this folder open in Windows Explorer when created.

Is this possible?

regards

Pete
 
re:

Hi,
sure...either use the followhyperlink or shell method e.g.:

Dim stAppName As String

stAppName = "C:\WINDOWS\explorer.exe " & strDirectoryPath1
Call Shell(stAppName, 1)

OR

Application.FollowHyperlink strDirectoryPath1

You might also want to check if the path already exists before you actually create it e.g.:

If Len(Dir(strDirectoryPath1, vbDirectory)) = 0 Then
'doesn't exist so create it
Else
'already exists so do nothing
End If

HTH
Good luck
 
Thank you very much for your reply, and thanks for the extra help on checking if the path exists.

Thank you.

Kind Regards

Pete
 

Users who are viewing this thread

Back
Top Bottom