HIS AGENT IS USED TO EXPORT THE CURRENT VIEW DATA TO EXCEL-
Procedure :
Procedure :
1. Create New Lotus Script Agent with Menu Selection property
2. Copy Below Complete Lotus Script Code and Paste it in Initialize
3. Save this agent with proper name
4. Close the agent and goto any view in your database
5. Find your agent name in "Action" Menu and run it.
6. Excel File will be ready to desktop.
7. Done.
EXPORT TO EXCEL ANY VIEW :
Const visualproc = True 'Display Visualvisual progress bar true = yes /false = no
Const AppConst = "Excel.Application"
Const AppConst2 = "Excel.Application.8"
Const NPB_TWOLINE% = 1
' Procedures in nnotesws.dll (undocumented!!).
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim nc, nl, nmore
Dim selList(0 To 20) As String
Dim vcol List As String
Dim excelAppObject As Variant
Declare Function NEMProgressBegin Lib "nnotesws.dll" ( Byval wFlags As Integer ) AsLong
Declare Sub NEMProgressEnd Lib "nnotesws.dll" ( Byval hwnd As Long )
Declare Sub NEMProgressSetBarPos Lib "nnotesws.dll" ( Byval hwnd As Long, Byval dwPosAs Long)
Declare Sub NEMProgressSetBarRange Lib "nnotesws.dll" ( Byval hwnd As Long, ByvaldwMax As Long )
Declare Sub NEMProgressSetText Lib "nnotesws.dll" ( Byval hwnd As Long, ByvalpcszLine1 As String, _
Byval pcszLine2 As String )
Class ProgressBar
' Objects
Private hwnd As Long
' Constructor.
Sub New (BarRange As Long)
On Error Goto ErrorHandler
' Create the visual progress bar.
Me.hwnd = NEMProgressBegin (NPB_TWOLINE)
' Set the bar range.
Call NEMProgressSetBarRange (Me.hwnd, BarRange)
Exit Sub
ErrorHandler:
Dim TheError As String
TheError = "Constructor: Error " + Str(Err) + ": " + Error$
Messagebox TheError, 0 + 48, "visual progress bar Error"
End Sub
' Use Destructor.
Sub Delete
' Destroy the visual progress bar.
Call NEMProgressEnd (Me.hwnd)
End Sub
Public Sub UpdatePosition (BarPos As Long)
' Update the bar position.
Call NEMProgressSetBarPos (Me.hwnd, BarPos)
End Sub
Public Sub UpdateProgressText (BarMsg As String, UpdateMsg As String)
' Update progress text.
Call NEMProgressSetText (Me.hwnd, BarMsg, UpdateMsg)
End Sub
End Class
Sub Initialize
On Error Goto ExitExcel
'Main Code starts here
Dim session As New NotesSession
Dim workspace As New NotesUIWorkspace
Dim UIview As NotesUIView
Dim collection As NotesDocumentCollection
Dim coldoc As NotesDocument
Dim BarMsg As String, UpdateMsg As String
Dim countall As Long, countthis As Long, countallsel As Long, countthissel As Long
Dim NChar As String
Set UIview = workspace.CurrentView
Set db = session.CurrentDatabase
UIViewname = UIView.ViewName
UIViewAlias = UIView.Viewalias
Set view = db.GetView( UIViewName )
Set collection = db.UnprocessedDocuments
gowithselection = False
goonall = True
'Determine if it is a collection
countallsel = collection.count
If countallsel >1 Then
gowithselection = workspace.Prompt(PROMPT_YESNO, "Selection found", "Export only selected documents?")
Set doc=collection.getfirstdocument
'Check if there is really a doc selected
If (doc Is Nothing) And (goonwithselection) Then
Msgbox "Invalid selection"
Exit Sub
End If
Set doc = Nothing
BarMsg = "Exporting selected documents ..."
Else
goonall = workspace.Prompt(PROMPT_YESNO, "No Selection found", "Export all documents?" + Chr$(13) + "Info: If you want to export only selected documents," +Chr$(13) + "please select these documents before running this script.")
If goonall=False Then
Print "Exiting..."
Exit Sub
Comments
Post a Comment