pavan kumar penmetsa 1.Aug.11 02:52 AM a Web browser Domino Designer6.5.5All Platforms
I have written the following code ina action button in a view to export selected documents to excel
the code is as below
Sub Click(Source As Button)
Dim s As New notessession
Dim db As notesdatabase
Set db= s.currentdatabase
Dim uiw As New NotesUIWorkspace
Dim Doc As NotesDocument
Dim cview As NotesView
Dim doccol As NotesDocumentCollection
Dim tempdoc As notesdocument
Dim ws As New NotesUIWorkspace
Set uiv = uiw.currentview
currentviewname = uiv.viewname
Set cview = db.GetView(currentviewname)
cview.AutoUpdate=False
If cview Is Nothing Then
Messagebox "Could not open the view. """ & currentviewname & """"
Exit Sub
End If
Set doccol = db.unprocesseddocuments
If doccol.count >0 Then
resp = Messagebox("Do you want to export only the " & _
"selected " & doccol.count & " documents?", 36, "Selected only?" )
Else
Messagebox "Exporting all Documents."
End If
Dim xlApp As Variant
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = False
xlApp.Workbooks.Add
xlApp.displayAlerts=False
hcolmn=1
Forall c In cview.Columns
xlApp.cells(1,hcolmn) = c.title
hcolmn=hcolmn+1
End Forall
row=2
If resp=6 Then
Dim seldoc As notesdocument
Set seldoc = doccol.GetFirstDocument
While Not seldoc Is Nothing
If resp=6 Then
Set Doc = cview.getnextdocument(seldoc) '' i'm getting the mentioned here
If Doc Is Nothing Then
Set Doc = cview.getprevdocument(seldoc)
If Doc Is Nothing Then
Print " >1 doc should be selected"
End
Else
Set Doc = cview.getnextdocument(Doc)
End If
Else
Set Doc = cview.getprevdocument(Doc)
End If
End If
For colmn = 0 To Ubound(cview.Columns)
xlApp.cells(row,colmn+1) = Doc.columnvalues(colmn)
Next
row=row+1
Set seldoc = doccol.GetNextDocument(seldoc)
Wend
Else
Set Doc = cview.GetFirstDocument
While Not Doc Is Nothing
For colmn = 0 To Ubound(cview.Columns)
xlApp.cells(row,colmn+1) = Doc.columnvalues(colmn)
Next
row=row+1
Set Doc = cview.GetNextDocument(Doc)
Wend
End If
location
xlApp.save
End Sub
when i'm clicking the button after selecting some documents in the view its giving the below error
Set Doc = cview.getnextdocument(seldoc) giving the error : index entry has too many levels(view name)
I'm not getting any idea why it is giving that error.
Please help me how to avoid this error.