Hi Mashiul
Try this:
Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _
ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Sub OpenGreatestFile()
Dim xRow As Long
Dim xDirect$, xFname$, InitialFoldr$, xFname2Open$
InitialFoldr$ = "U:\Engineering\Design\DWG\" & Left(ActiveCell.Value, 3) & "\" '<<< Startup folder to begin searching from
xFname$ = Dir(InitialFoldr$, 7)
xFname2Open$ = xFname$
Do While xFname$ <> ""
If xFname$ > xFname2Open$ And xFname$ <> "Thumbs.db" Then
xFname2Open$ = xFname$
End If
xFname$ = Dir
Loop
ShellExecute 0, "Open", InitialFoldr$ & xFname2Open$, "", "", vbNormalNoFocus
End Sub
Regards,
Rick
Bookmarks