Agent name is "ExportCompleted.xls. In the Initialize section of my agent, I have the following code:
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim excel As Variant
Dim worksheet As Variant
Dim cell As Variant
Dim view As NotesView
Dim nav As NotesViewNavigator
Dim entry As NotesViewEntry
Dim rowNum As Integer
Print {Content-Type:application/vnd.ms-excel}
Print {<HTML><HEAD>}
Print {</HEAD>}
Print {<BODY>}
Print {<TABLE>}
Print {<TR>}
Print {<TD WIDTH="65"><B>AI Change No</B></TD>}
Print {<TD WIDTH="100"><B>Status</B></TD>}
Print {<TD WIDTH="90"><B>Date Rcvd</B></TD>}
Print {<TD WIDTH="120"><B>Requestor</B></TD>}
Print {<TD WIDTH="150"><B>Platform</B></TD>}
Print {<TD WIDTH="120"><B>Servers Impacted</B></TD>}
Print {<TD WIDTH="160"><B>Applications Impacted</B></TD>}
Print {<TD WIDTH="200"><B>Type of Change</B></TD>}
Print {<TD WIDTH="150"><B>Red Watch</B></TD>}
Print {<TD WIDTH="160"><B>Start Date/Time</B></TD>}
Print {<TD WIDTH="160"><B>End Date/Time</B></TD>}
Print {<TD WIDTH="80"><B>Chg Ticket Rcvd</B></TD>}
Print {<TD WIDTH="90"><B>Risk</B></TD>}
Print {<TD WIDTH="140"><B>Mop/Backout Plan Received</B></TD>}
Print {<TD WIDTH="400"><B>Scheduling Status</B></TD>}
Print {<TD WIDTH="140"><B>NFC Created for REDWATCH Apps</B></TD>}
Print {<TD WIDTH="120"><B>Duration & Outage</B></TD>}
Print {<TD WIDTH="400"><B>Details of Change</B></TD>}
Print {<TD WIDTH="120"><B>Scheduling Prime</B></TD>}
Print {<TD WIDTH="150"><B>IBM/CSA Contact</B></TD>}
Print {</TR>}
rowNum = 2
' Current row of data
' Get a NotesViewNavigator from our view
Set db = session.CurrentDatabase
Set view = db.GetView("AI_CRCompleted")
Set nav = view.CreateViewNav
Set entry = nav.GetFirst
' Go through all the entries in the view
While Not entry Is Nothing
Print {<TR>}
Print {<TD>} & entry.ColumnValues(2) & {</TD>}
Print {<TD>} & entry.ColumnValues(3) & {</TD>}
Print {<TD>} & entry.ColumnValues(4) & {</TD>}
Print {<TD>} & Cstr(entry.ColumnValues(5)) & {</TD>}
Print {<TD>} & Cstr(entry.ColumnValues(6)) & {</TD>}
Print {<TD>} & Cstr(entry.ColumnValues(7)) & {</TD>}
Print {<TD>} & Cstr(entry.ColumnValues(8)) & {</TD>}
Print {<TD>} & Cstr(entry.ColumnValues(9)) & {</TD>}
Print {<TD>} & Cstr(entry.ColumnValues(10)) & {</TD>}
Print {<TD>} & Cstr(entry.ColumnValues(11)) & {</TD>}
Print {<TD>} & Cstr(entry.ColumnValues(12)) & {</TD>}
Print {<TD>} & Cstr(entry.ColumnValues(13)) & {</TD>}
Print {<TD>} & Cstr(entry.ColumnValues(14)) & {</TD>}
Print {<TD>} & Cstr(entry.ColumnValues(15)) & {</TD>}
Print {<TD>} & Cstr(entry.ColumnValues(16)) & {</TD>}
Print {<TD>} & Cstr(entry.ColumnValues(17)) & {</TD>}
Print {<TD>} & Cstr(entry.ColumnValues(18)) & {</TD>}
Print {<TD>} & Cstr(entry.ColumnValues(19)) & {</TD>}
Print {<TD>} & Cstr(entry.ColumnValues(20)) & {</TD>}
Print {<TD>} & Cstr(entry.ColumnValues(21)) & {</TD>}
Print {</TR>}
rowNum = rowNum + 1
Set entry = nav.GetNext(entry)
Wend
Print "</TABLE></BODY></HTML>"
End Sub
My questions is that I have another agent that outputs "Cancelled requests" using the same columns. How can I have that report outputting to the same spreadsheet but in another worksheet when I run my agent?
The code for the cancelled requests is the same except the view name is different.