Domino 9 und frühere Versionen > ND6: Entwicklung

ausgewählte docs ins excel exportieren????

(1/3) > >>

Viktor:
hallo forum

mit dieser action (siehe unten) werden alle dokumente aus einer ansicht direkt ins excel exportiert, so weit so gut.

meine frage: kann man aber nur ausgewählte dokumente aus einer ansicht ebenfalls so exportieren, wenn ja wie?

besten dank im voraus

gruss

viktor

:_________________________________________________


Sub Click(Source As Button)
   Dim Session As New NotesSession
   Dim db As NotesDatabase
   Dim sourceview As NotesView
   Dim sourcedoc As NotesDocument
   Dim dataview As NotesView
   Dim datadoc As NotesDocument
   Dim maxcols As Integer
   Dim WS As New Notesuiworkspace
   Dim UiView As notesuiview
   Dim cols As Integer
   Dim rows As Integer
   Dim getfield As Variant
   
   Set db = session.CurrentDatabase
   Set UiView=WS.currentview
   Set dataview = uiview.view
   Dim xlApp As Variant
   Dim xlsheet As Variant
   
   Set xlApp = CreateObject("Excel.Application")
   xlApp.StatusBar = "Import vorbereiten..."
   xlApp.Visible = True
   xlApp.Workbooks.Add
   xlApp.ReferenceStyle = 2
   Set xlsheet = xlApp.Workbooks(1).Worksheets(1)
   xlsheet.Name = uiview.viewname
   xlApp.StatusBar = "Überschriften erstellen..."
   cols=1
   Forall X In dataview.Columns
      xlsheet.Cells(1,cols).Value =X.title
      cols=cols+1
   End Forall
   
   xlApp.StatusBar = "Überschriften erstellen...fertig!"
   xlApp.StatusBar = "Import vorbereiten..."
   xlApp.StatusBar = "Daten importieren..."
   Set datadoc = dataview.getfirstdocument
   cols=1
   rows=2
   maxcols= dataview.columncount
   While Not (datadoc Is Nothing)
      For cols=0 To maxcols-1
         getfield = Cstr(datadoc.ColumnValues( cols ))
         xlsheet.Cells(rows,cols+1).Value = getfield
      Next
      rows=rows+1
      cols=0
      Set datadoc = dataview.getnextdocument(datadoc)
   Wend
   xlApp.StatusBar = "Import beendet! ... Formatieren starten"
   
   xlApp.Rows("1:1").Select
   xlApp.Selection.Font.Bold = True
   xlApp.Range(xlsheet.Cells(1,1), xlsheet.Cells(1,maxcols)).Select
   With xlApp.Selection.Interior
      .ColorIndex = 15
      .Pattern = 17 'xlGray16
      .PatternColorIndex =6
   End With
   xlApp.StatusBar = "Titel formatiert"
   xlApp.Rows("1:1").Select
   xlApp.Selection.Font.Bold = True
   xlApp.Range(xlsheet.Cells(1,1), xlsheet.Cells(rows,maxcols)).Select
   xlApp.Selection.Font.Name = "Arial"
   xlApp.Selection.Font.Size = 9
   xlApp.Selection.Columns.AutoFit
   With xlApp.Worksheets(1)
      .PageSetup.Orientation = 2
      .PageSetup.centerheader = "Report - Confidential"
      .Pagesetup.RightFooter = "Page &P" & Chr$(13) & "Date: &D"
      .Pagesetup.CenterFooter = ""
   End With
   xlApp.ReferenceStyle = 1
   xlApp.Range("A1").Select
   xlApp.StatusBar = "Fertig!"
End Sub

klaussal:
Suche mal in der Hilfe nach dem Stichwort "Unprocessed documents".

klaus

Viktor:
danke klaus aber ich komme leider nicht weiter :-( :-[

Axel:
Hi,

so geht's:

Dim Session As New NotesSession
Dim db As NotesDatabase
Dim collection As NotesDocumentCollection
Dim doc As NotesDocument

Set db = session.CurrentDatabase
Set collection = db.UnprocessedDocuments

Set doc = collection.GetFirstDocument
While Not (doc Is Nothing)

'hier findet die Verarbeitung der einzelnen Doks statt

  Set doc = collection.GetNextDocument(doc)
Wend


Axel

Viktor:
hallo axel

und wie kann ich das in meinem script inplementieren?
SORRY, Ich kenn mich ein wenig aus, aber nicht so gut, dass ich schon alle Funktionen etc. kennen würde. Bin daher für jeden Tipp sehr dankbar.

Vielen Dank und Gruss

Viktor

Navigation

[0] Themen-Index

[#] Nächste Seite

Zur normalen Ansicht wechseln