Problem with import from excel?

Hi I have fallowing problem, I use code wchih is use to import items from Excel and import work’s well. If I open view with imported documents it’s look great but if I use commant:@SetViewInfo([SetViewFilter];“2”;“Proc_wag”;1)

Iit don’t work I must first open any documents one by one and if I use this command again I see required documents. I supposed that @SetViewInfo works only with document which have UID.

Is possible to that import document that those will be see if I use @SetViewInfo and not open it before.

My import code looks like below.

Thanks

Sub Click(Source As Button)

On Error Goto errmsg



Dim workspace As New NotesUIWorkspace

Dim count As Double

Dim counter As Double

count = 0

counter = 0

Dim session As New NotesSession

Set dbCurr = session.CurrentDatabase





Dim xlFilename As Variant

xlFilename = workspace.OpenFileDialog(True, "Lista plików do wyboru", _

"Excel|*.xls", "c:")

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





If xlFilename(0) = "0" 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(0) & "..."

Excel.Workbooks.Open xlFilename(0)'// 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 ( "Procfolder" )



If view Is Nothing Then

	Exit Sub

End If



Call view.Refresh



Dim antwort As Integer

antwort = Msgbox ( "Będziesz importwał " & NumberOfRows & " 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 = "Proc_form"

		

		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_data_dod= xlSheet.Cells( RowPointer , 5 ).Value

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

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

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

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

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

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

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

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

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

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

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

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

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

		doc.Proc_uwagi_ogolne= xlSheet.Cells( RowPointer , 19 ).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 (xlFilename(0) & "to")

'/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 import from excel?

-Does the form field: proc_wag after it is imported and before you physically open and re-save it has the correct value? (=“2”)

-What is the field formula? Type? Is it a number or a string?

if it is a string value, then try adding:

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

if it is a number value then try cint or clong(xlSheet.Cells( RowPointer , 3 ).Value)


If the value on the form is correct, then before the ws.viewrefresh, add a view.refresh

Hope this helps