Magari a qualcuno puo’ servire : e’ un pezzetto di LotusScript che lanciato da una view esporta i valori presenti nelle colonne della view stessa in Excel, e’ generico e quindi non c’e’ bisogno di parametrizzarlo per view diverse.
Non l’ho ottimizzato, potrebbero esserci ancora delle Dim non piu’ necessarie.
Sub Initialize Dim x,y As Integer Dim conta, salto,lunga As Integer Dim strLen As Integer Dim ses As NotesUIworkspace Dim vw As NotesUIView Dim view As NotesView Dim doc As NotesDocument Dim it As Variant Dim viewcollec As notesviewentrycollection Dim viewentry As notesviewentry Dim session As New NotesSession Dim db As NotesDatabase Set db = session.CurrentDatabase Set ses = New NotesUIWorkspace Set vw = ses.currentview Set View = vw.View ‘Prepara l'appl Excel Dim xlApp As Variant Dim xlSheet As Variant Set xlApp = CreateObject(“Excel.application”) xlApp.Workbooks.Add Set xlSheet = xlApp.Workbooks(1).Worksheets(1) xlApp.Visible = True ? rende Excel visibile ‘ Orientamento della pagina per la stampa (opzionale) ‘Valori possibili: ‘1 = Portrait ‘2 = Landscape xlSheet.PageSetup.Orientation = 2 ‘Titoli delle colonne x=0 Forall c In view.Columns x=x+1 xlSheet.Columns(x).Columnwidth = c.Width xlSheet.Columns(x).VerticalAlignment = 1 xlSheet.Cells(1, x).Value = c.Title End Forall Set viewcollec=view.allentries Set ViewEntry = viewcollec.GetFirstEntry( ) x=1 Do While Not viewentry Is Nothing x=x+1 y=0 Forall v In viewentry.ColumnValues y=y+1 xlSheet.Cells(x, y).Value = v End Forall Set ViewEntry = viewcollec.GetNextEntry( viewentry ) Loop Msgbox “Il foglio Excel e’ pronto, ricordati di salvarlo!”, 64, “Excel Export” End Sub
Buon codice !
0 commenti