Problem with change Inputbox for OpenFileDialog

I have kind question for all, I use „Inputbox” in below pressed code to take name of file for Import from excel, I want change “Inputbox” to “OpenFileDialog” But I haven’t idea how do that. Pleas can you help me? I try use:xlFilename = notesUIWorkspace.OpenFileDialog(False, “Select file for Import”, “.xls”)

code but it don’t work.

Sub Click(Source As Button)

On Error Goto errmsg



Dim count As Double

Dim counter As Double

count = 0

counter = 0

Dim session As New NotesSession

Set dbCurr = session.CurrentDatabase





Dim xlFilename As String

'// (I try it but don't work) xlFilename = notesUIWorkspace.OpenFileDialog(False, "Select file for Import", ".xls")

xlFilename = Inputbox ( "Proszę podac ścieżkę do pliku wejsciowego excel Przykładowo c:\excel.xls", "Wybór ścieżki pliku do importu" , "" )



If xlFilename = "" Then

	Exit Sub

End If



Dim One As String



Dim row As Integer

Dim written As Integer

'// We connect to Excel and open the file. Then start pulling over the records.

Dim Excel As Variant

Dim xlWorkbook As Variant

Dim xlSheet As Variant

Print "Connecting to Excel..."

Set Excel = CreateObject( "Excel.Application" )

Excel.Visible = False '// Don't display the Excel window

Print "Opening " & xlFilename & "..."

Excel.Workbooks.Open xlFilename '// Open the Excel file

Set xlWorkbook = Excel.ActiveWorkbook

Set xlSheet = xlWorkbook.ActiveSheet



Print "Uruchamianie importu z pliku excel......."



Dim NumberOfRows As Long

NumberOfRows = xlSheet.UsedRange.Rows.Count

count = xlSheet.UsedRange.Rows.Count 

Dim RowPointer As Long



Dim i As Integer



Dim view As NotesView

Set view = dbCurr.GetView ( "a1" )



If view Is Nothing Then

	Exit Sub

End If



Call view.Refresh



Dim antwort As Integer

antwort = Msgbox ( "Będziesz importwał" & Wierszy & " zapisanych w bazie danych. Kontynuować?" , 4 , "Start import?" )



If antwort <> 6 Then

	Exit Sub

End If



Dim schluessel As String

Dim doc As NotesDocument

Dim summe As Double



For RowPointer = 1 To NumberOfRows

	

	schluessel = xlSheet.Cells( RowPointer , 1 ).Value 

	Set doc = view.GetDocumentByKey ( schluessel , True )

	

	If doc Is Nothing Then

		

		Set doc = dbCurr.CreateDocument

		doc.Form = "test_excel"

		

		doc.Proc_ID= xlSheet.Cells( RowPointer , 1 ).Value

		doc.Proc_nazw= xlSheet.Cells( RowPointer , 2 ).Value

		doc.Proc_wag= xlSheet.Cells( RowPointer , 3 ).Value

		doc.Proc_ID_zas= xlSheet.Cells( RowPointer , 4 ).Value

		doc.Proc_nazw_zas= xlSheet.Cells( RowPointer , 5 ).Value

		doc.Proc_cel= xlSheet.Cells( RowPointer , 6 ).Value

		doc.Proc_cel_1= xlSheet.Cells( RowPointer , 7 ).Value

		doc.Proc_general_omow= xlSheet.Cells( RowPointer , 8 ).Value

		doc.Proc_general_zakres= xlSheet.Cells( RowPointer , 9 ).Value

		doc.Proc_general_wdroz= xlSheet.Cells( RowPointer , 10 ).Value

		doc.Proc_general_admin= xlSheet.Cells( RowPointer , 11 ).Value

		doc.Proc_general_zarzad= xlSheet.Cells( RowPointer , 12 ).Value

		doc.Proc_general_zalec= xlSheet.Cells( RowPointer , 13 ).Value

		doc.Proc_general_szkol= xlSheet.Cells( RowPointer , 14 ).Value

		doc.Proc_general_kontrola= xlSheet.Cells( RowPointer , 15 ).Value

		doc.Proc_uwagi_ogolne= xlSheet.Cells( RowPointer , 16 ).Value

		

		

		counter = counter + 1

		Call doc.Save ( True , True )

		

	End If

	

	Print RowPointer & " przetwarzanych rekordów, " & counter & " stworzono dokumentów!"

	

Next



Print "Rozłącznie z excelem..........."

xlWorkbook.Close False '// Close the Excel file without saving (we made no changes)

Excel.Quit '// Close Excel

Set Excel = Nothing '// Free the memory that we'd used

Print " " '// Clear the status line



Msgbox RowPointer & " przetwarzanych rekordów,, " & counter & " stworzono dokumentów!"



Dim ws As New NotesUIWorkspace

Call ws.ViewRefresh



Exit Sub

errmsg:

Msgbox ( "Błąd importu " & Error & " w lini numer " & Erl )

Msgbox "Linie w pliku excel " & RowPointer

Print " " '// Clear the status line



Exit Sub

End Sub

Subject: Problem with change Inputbox for OpenFileDialog.

OpenFileDialog returns an array, not a string, even if you have the multiple file setting set to False. So declare xFileName as a Variant to catch the array, then use xFileName(0) to get the selected filename.

Subject: Problem with change Inputbox for OpenFileDialog.

Tahank you very much, I used your advice and it work’s.