Manage Learn to apply best practices and optimize your operations.

Export to Excel

Export a view to Excel worksheet.


Sub Initialize
Set Session = New NotesSession
Set pDb = Session.CurrentDatabase

Dim Client As String
Dim CellRange As String
Dim Group As String
Dim Dates As Integer
Dim Branch As String
Dim Requester As String
Dim Counsel As String
Dim Types As String
Dim Holiday As Single
Dim II As Integer
Dim MaxTab As Integer
Dim OldSiteName As String
Dim OT As Single
Dim PayBasis As String
Dim Premium As Single
Dim Rate As Single
Dim RegT As Single
Dim SheetNo As Integer
Dim Sick As Single
Dim SiteName As String
Dim SlashPos As Integer
Dim SSN As String
Dim TmplFileName As String
Dim Vacation As Single
Dim WD As Integer

' Check to see if the user has imported the data from TimeCenter
Dim view As NotesView
Set view = pDb.GetView("DateRec")

Dim vdoc As NotesDocument
Set vdoc = view.GetFirstDocument
If vdoc Is Nothing Then
Messagebox "Before running this process, click on the 'Import Sites Status File' action button"
Exit Sub
End If

Print "Moving data from the Notes Documents into a spreadsheet, please wait ..."

Dim doc As notesdocument
Set doc = New notesdocument (pDb)

Dim rtitem As notesrichtextitem
Set rtitem = New notesrichtextitem(doc, "Body")

' Embed the Main Excel template
TmplFileName = C:\notes\data\template.xls"
Dim object As notesembeddedobject
Set object = rtitem.embedobject(EMBED_OBJECT, "", TmplFileName, "Contracts")

' Activate the Excel object
Set pHandle = object.activate (True)

' Define the Sheet col/row references
pColClient = "A"
pColGroup = "B"
pColDates = "C"
pColBranch = "D"
pColRequester = "E"
pColCounsel = "F"
pColTypes = "G"
'The first sheet is the Summary sheet - so the first real worksheet is number 2
SheetNo = 1
pRow = 8
Dim Cell As String
' Extract the data from the document
Do While Not (vdoc Is Nothing)

pRow = pRow + 1

' Move in the Client Name
Cell = pColClient & Cint(pRow)
pHandle.application.range(Cell).value = vdoc.Client (0)

' Move in the Group
Cell = pColGroup & Cint(pRow)
pHandle.application.range(Cell).value = vdoc.Group (0)

' Move in the Dates
Cell = pColDates & Cint(pRow)
pHandle.application.range(Cell).value = vdoc.DateRec (0)
' Move in the Branch
Cell = pColBranch & Cint(pRow)
pHandle.application.range(Cell).value = vdoc.Branch (0)

' Move in the Requester
Cell = pColRequester & Cint(pRow)
pHandle.application.range(Cell).value = vdoc.RespondTo (0)

' Move in the Counsel
Cell = pColCounsel & Cint(pRow)
pHandle.application.range(Cell).value = vdoc.Atty (0)

' Move in the Types
Cell = pColTypes & Cint(pRow)
pHandle.application.range(Cell).value = vdoc.ContractType (0)

' Point to the next document
Set vdoc = view.GetNextDocument(vdoc)
Loop

Call pHandle.Application.ActiveSheet.Protect("test", True, True, True, True)
'pHandle.parent.save

' Update the Workflow document fields, and SAVE doc.Form = "ToGo"
'
' Save the document
Call doc.save (True, True)
Messagebox "Use file save as to save this spread sheet then click OK"
Print "Import completed successfully"

End Sub

Dig Deeper on Lotus Notes Domino Administration Tools

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchDataCenter

SearchContentManagement

Close