I have a frameset with an outline in the left pane, and the view in the right pane. The code in the outline entry is:
@Command([ToolsRunMacro]; “MyAgent”)
and the agent I am running looks to find the selected documents in the current view. When I run the agent from the Actions menu it works fine, however, when I run it from the outline entry, the value of NotesUIWorkspace.CurrentView is Nothing.
Does anyone have a workaround for this?
Subject: NotesUIWorkspace, Outline and CurrentView
use NotesDatabase.UnprocessedDocuments instead
Subject: RE: NotesUIWorkspace, Outline and CurrentView
here’s some more info…
I am using code written by Ken Pespisa (kpespisa@attbi.com) from his Export to Excel db in the Sandbox. The code requires that the NotesUIWorkspace.CurrentView is set. Here’s the code:
'-----------------------------------------------------------------
' Main script for exporting a view to Excel.
'
' The script determines the mode selected. It can either be all
' documents in view, or just selected documents. Then the user
' may be prompted to export the current view or a customized view.
' You can turn off that prompt using the PROMPT_FOR_CUSTOM_VIEW
' constant found below.
'
' Once the view is chosen, the script determines the view column
' order. It skips hidden columns, response columns, and columns
' with formulas equal to "". If customizable view is chosen, the
' user can select which columns to export, the order to export them,
' and what sort order they're given.
'-----------------------------------------------------------------
On Error Goto ErrorTrap
Dim taskID As Integer
Dim sRun As String
Dim sResponse As String
Dim arrColumnOrder() As Integer
Set s = New Notessession
Set w = New NotesUIWorkspace
Set db = s.CurrentDatabase
'Get Export Options Document
Call GetExportOptions()
'Get Current View
'***********************************************
'w.CurrentView will return nothing.
If w.CurrentView Is Nothing Then
iCurrentViewExists = False
Else
iCurrentViewExists = True
Set view = w.CurrentView.View
End If
'If Custom Export chosen, prompt user for which source to use.
If sType = "Custom" Then
sResponse = GetExportSource
If sResponse = "" Then Exit Sub
Else
If Not iCurrentViewExists Then
Msgbox "Unable to export view because no view found. This may" & _
" occur if the current view is an embedded view.", 16, "Unable to Export"
Exit Sub
Else
sResponse = "Current View -- " & view.Name & Space(150) & "$$$" & "0" & view.Name
End If
End If
etc…
Subject: RE: NotesUIWorkspace, Outline and CurrentView
Yes, that code is written to be able to export documents from a view regardless of whether there are any selected documents or not. You will have to modify it to suit your application since it does not work for embedded views or, in your case, views referenced in a back-end agent.