Domino 9 und frühere Versionen > Entwicklung
Bitte Erklärung: Excel in Notes nutzen.
Darkface:
Hallo zusammen,
könnte mir mal jemand erklären, wie ich mit Lotus Notes auf Excel zugreifen kann und folgende Werte in die Tabelle schreiben kann.
Name
Vorname
Dies sind auch die Feldnamen im Dokument.
Über eine Antwort und eine Erklärung würde ich mich sehr freuen.
MFG
Darkface
Don Pasquale:
Hi,
hier ist ein Script mit dem ich ein Worddokument aufrufe.
Ich habe bisher halt nur auf Word zugegriffen,
in dem WordDokument waren Felder eingefügt (hier: IDENTNUMMER)
Vielleicht kannst Du das Script ja umstricken
Don Pasquale
--- Code: ---
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument
Dim object As NotesEmbeddedObject
Dim s As New notessession
Dim heute As New notesdatetime("heute")
Dim word As Variant
Dim wordoc As Variant
Dim Worddokumentname As String
Dim Identnummer As String
'Predefined values: (replace with field values from uidoc)
Worddokumentname = uidoc.FieldGetText("subject")
'Create the Word object:
Set word = CreateObject("Word.Application") 'Create Word object
'Create a new document based on the template "TESTVORLAGE01.DOT"
Call word.documents.add("C:\Vorlagen\Vorlage01.dot")
Set worddoc = word.activedocument 'Get a handle for the active document
'Assign the field values:
worddoc.FormFields("IDENTNUMMER").result = uidoc.FieldGetText("Identnummer")
worddoc.saveas(Worddokumentname) 'save the document with the filename of "user"
word.visible = True 'Comment this line if you don't want to show Word.
'word.quit 'remove comment if you want to close rather than show Word.
--- Ende Code ---
Axel:
Hi,
ich hab vor einiger Zeit mal eine Klasse für den Zugriff auf Excel geschrieben. Ist mit Sicherheit noch nicht das Non-Plus-Ultra, aber sie funktioniert. Ich will sie irgendwann, wenn mal Zeit ist, neu machen.
Packe die Codezeilen in den Declaration - Teil einer Script-Bibliothek.
--- Zitat ---
Class cExcel
objExcel As Variant
objSheet As Variant
' Konstruktor
Sub New
Set objExcel = Nothing
Set objExcel = CreateObject("Excel.Application")
End Sub
' Destruktor-Prozedur
Sub Delete
Set objExcel = Nothing
End Sub
' Bringt Excel als Vollbild in den Vordergrund
Sub ActivateExcel
objExcel.Visible = True 'Excel sichtbar machen
objExcel.Windows(1).WindowState = -4137
objExcel.Windows(1).Activate
End Sub
' Erstellt eine neue Arbeitsmappe
Sub NewWorkbook
Call objExcel.Workbooks.Add
Set objSheet = objExcel.Workbooks(1).Worksheets(1)
End Sub
' Schreibt einen Wert in die angegebene Zelle
Sub SetCellValue(sZiel As Variant, sValue As Variant)
objSheet.Range(sZiel).Value = sValue
End Sub
' Formatiert einen Bereich als Text
Sub FormatRangeText(sZiel As Variant)
objSheet.Columns(sZiel).Select
objExcel.Selection.NumberFormat ="@"
objSheet.Range("A1").Select
End Sub
'Formatiert ein Arbeitsblatt mit den Attributen vertikale Textausrichtung oben und
'optimale Spaltenbreite
Sub FormatRangeAlignment
objSheet.Cells.Select 'Gesamtes Arbeitsblatt markieren
objExcel.Selection.VerticalAlignment = -4160 'Vertikale Ausrichtung nach oben
objExcel.Selection.Columns.AutoFit 'Optimale Spaltenformel
objExcel.Selection.Rows.AutoFit 'Optimale Spaltenhöhe
objSheet.Range("A1").Select
End Sub
End Class
--- Ende Zitat ---
Beispiel:
...
Dim oExcel As cExcel
Set oExcel = New cExcel 'Erstellen eines OLE-Objects
Call oExcel.NewWorkbook 'Erstellt neue Arbeitsmappe
Call oExcel.SetCellValue("A1", doc.Feldname(0)) 'Feldinhalt in Zelle A1
Call oExcel.ActivateExcel 'Excel in den Vordergrund
Delete oExcel
...
Axel
Axel:
Hi,
ich hab noch was gefunden. Schau mal hier, vielleicht kannst du damit was anfangen.
http://217.160.137.156/html/cgi-bin/yabb/YaBB.pl?board=Downloads;action=display;num=1014050197
Axel
Don Pasquale:
Hi Axel,
Call oExcel.SetCellValue("A1", doc.Feldname(0)) 'Feldinhalt in Zelle A1
hier bekomme ich eine "Variant does not contain Object"
Meldung - Wo habe ich etwas übersehen ??
pasquale
Navigation
[0] Themen-Index
[#] Nächste Seite
Zur normalen Ansicht wechseln