'This example requires the following controls on a form:
' - CommandButton (name=Command1)
' - A Common Dialog Box (CommonDialog1)
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
Private Sub Command1_Click()
Dim RetVal
CommonDialog1.FileName = ""
CommonDialog1.Filter = "Microsoft Excel (*.xls))|*.xls"
CommonDialog1.ShowOpen
RetVal = ShellExecute(Me.hwnd, "Open", CommonDialog1.FileName, "", "",
1)
End Sub

Signature
Saludos ... Miguel Angel Martínez Morgan ... 8-)
> Hi All,
> Can any one help me to writhe a code in VB so that by clicking command
> button I should get all the excel files displayed and if I click the
> selected excel file it should open
> TIA
kiran - 29 Dec 2004 12:05 GMT
thanks
> 'This example requires the following controls on a form:
> ' - CommandButton (name=Command1)
[quoted text clipped - 22 lines]
> > selected excel file it should open
> > TIA