Friday, August 31, 2007

LOTUSSCRIPT CODE FOR FILE OPEN DIALOG BOX

Lotus script code to show file open dialog box to browse and select files in windows.

Sample Agent code with settings "Manually from the Actions menu" and "Run Once (@Commands may be used)"

Declarations event:
-----------------------
Declare Function NEMGetFile Lib "nnotesws" ( wUnk As Integer, Byval FileName As String, Byval Filter As String, Byval Title As String ) As Integer

Initialize event:
-----------------------

Sub Initialize

Dim strFileName As String*256
Dim strTitle As String
Dim strFilter As String

strFileName = ""
strTitle = "Please select the Excel file to be imported"
strFilter = "MS Excel Files*.xls" 'Filter is set to show only .xls files

' Show file dialog box till a Excel file is selected
Do
ErrorStatus=False
If NEMGetFile( 0, strFileName, strFilter, strTitle) = 0 Then
retval=Msgbox( "You have not selected an Excel file for processing. Do you want to exit ?",4+256,"Abort")
If retval=7 Then
ErrorStatus=True
Else
Exit Sub
End If
End If
Loop Until ErrorStatus=False

Msgbox strFileName

End Sub