View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ivyleaf Ivyleaf is offline
external usenet poster
 
Posts: 141
Default Highlight Selected Excel file in Explorer

Hi Moonhk,

You were very close.

Sub APOpen_FileLocation()
Dim objShell As Object, strName As String
strName = ActiveWorkbook.FullName
On Error Resume Next
If Err.Number = vbEmpty Then
Set objShell = CreateObject("WScript.shell")
objShell.Run ("Explorer /select," & strName)
End If
Set objShell = Nothing
Set strDir = Nothing
End Sub

Cheers,
Ivan.

On Apr 1, 6:33*pm, moonhk wrote:
Hi Reader

Do you know how to higlight selected Excel file in Explorer ?

Sub APOpen_FileLocation()
Dim objFSO, objShell, strDir, strName
* *strDir = ActiveWorkbook.Path
* *strName = ActiveWorkbook.FullName
* *On Error Resume Next
* *'MsgBox strDir
* * Set objFSO = CreateObject("Scripting.FileSystemObject")
* * strDir = objFSO.getFolder(strDir)
* * If Err.Number = vbEmpty Then
* * * * Set objShell = CreateObject("WScript.shell")
* * * * objShell.Run ("Explorer" & " " & strDir)
* * * * '~~ Highlight Selected Excel file in explorer
* * End If
* * Set objFSO = Nothing
* * Set objShell = Nothing
* * Set strDir = Nothing
End Sub