Do You want to open Explorer from Excel with a specific directory open?
Using VBA, I need to open a directory using Explorer or Internet Explorer, but with a condition that if the directory doesn't exists, I will receive some kind of alert that will allow me to try a diferent path.
Yes, I need to open a specific directory (e.g: c:\temp), but I also need to be able to determine if that directory exists (e.g: c:\temp\test -> error)
I tried to use the shell command:
RetVal = Shell("C:\windows\explorer c:\temp", 1)
But in that way I can┤t determine if that works or not.
Thx for any hint,
Below You find an example:
VB:Option Explicit Sub Open_Explorer() Dim stFolder As String stFolder = "c:\Temp" If Len(Dir(stFolder, vbDirectory)) <> 0 Then Shell "Explorer.exe /n,/e," & stFolder, vbNormalFocus Else MsgBox "The directory does not exist!", vbCritical End If End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)