Hello,
I am trying to export totals from a notes view to excel. The data is exporting properly but the format is not correct. I need to exclude two columns and I need a consistent set of rows to show up in Excel. for example the notes view is like this:
Category X
A 1 1 1
b 2 2 0
C 3 4 0
Category Y
A 1 2 3
C 2 3 0
My excel spreadsheet should show up like this:
Category X
A 1 1 1
B 2 2 0
C 3 4 0
Category Y
A 1 2 3
B 0 0 0
C 2 3 0
The code I have is quite simple and it returns all the values for each category.
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim entry As NotesViewEntry
Dim viewnav As NotesViewNavigator
Dim col As Integer
Dim row As Double
Dim xl As Variant
Dim xlWbk As Variant
Dim pagename As String
Set db = session.CurrentDatabase
Set view = db.GetView(“Export Test”)
Set viewnav = view.CreateViewNav
Set xl = CreateObject(“Excel.Application”)
Set xlWbk=xl.Workbooks.Add
’ Add column headings to first row
col=1
Forall vColumn In view.Columns
xlWbk.ActiveSheet.Cells(1, col)=vColumn.Title
col=col+1
End Forall
row=2
Set entry = viewnav.GetFirst()
Do While Not entry Is Nothing
col=1
Forall cValue In entry.ColumnValues
xlWbk.ActiveSheet.Cells(row, col)=cValue
col=col+1
End Forall
row=row+1
Set entry = viewnav.GetNextCategory(entry)
Loop
’ Make all columns fit
xlWbk.ActiveSheet.Columns.AutoFit
Print “Excel Document Successfully Created!”
’ Open it up in Excel
xl.Visible=True
’ Open it up in Excel
xl.Visible=True
End Sub
Thank you for any suggestions in advance.
Asad