Kent,Here's my take on it ... It uses the MSComDlg.CommonDialog ActiveX control that - I think - gets installed and licensed with Office97+. Not everyone has this control exposed at the COM Automation level. Maybe that's why this guy went "under the covers" and called it throught the Windows API ...
code:
break on
$Filename = OpenCommonDialog("Excel Files (*.xls)|*.xls|All files (*.*)|*.*", "Open Excel File", "c:\", "*.xls", 0)
?"file = " $Filename
exit
function OpenCommonDialog($Filter,$Title,$Directory,$Extension,$FileMustExist)
$OpenCommonDialog = ""
$Dialog = CreateObject("MSComDlg.CommonDialog")
if $Dialog
$Dialog.Filter = $Filter
$Dialog.DialogTitle = $Title
$Dialog.InitDir = $Directory
$Dialog.Extension = $Extention
$Dialog.MaxFileSize = 128
If $FileMustExist
$Dialog.Flags = 4096
EndIf
$Dialog.ShowOpen()
$OpenCommonDialog = $Dialog.Filename
endif
endfunction
-Shawn