Das Notes Forum

Domino 9 und frühere Versionen => Entwicklung => Thema gestartet von: feargus am 25.04.02 - 09:00:57

Titel: Notes <> Excel
Beitrag von: feargus am 25.04.02 - 09:00:57
hat jemand rein Zufällig was zur Hand um Daten von Excel nach Notes bzw von Notes nach Exel zu schreiben ?

Das war irgendetwas mit create.objekt....
Titel: Re: Notes <> Excel
Beitrag von: eknori am 25.04.02 - 09:19:50
Hier der Code Excel 2 Notes :
Notes 2 Excel hatte ich hier mal was gepostet
http://www.atnotes.de/cgi-bin/yabb/YaBB.pl?board=Downloads;action=display;num=1014050197

Sub Initialize

' ==> This agent picks the data from the excel sheet and crates a document for each row
Dim sess As New notessession
Dim db As notesdatabase
Dim vw As notesview
Dim Doc As notesdocument
Dim report As notesdocument
Dim dataSheet As Variant

On Error Goto errorhandle

Set db = sess.currentdatabase

sheetLoc$ = Inputbox("Enter the locaiton of Excel Sheet","Location","c:\temp\MailMerge.xls") ' ==> The Excel Sheet file path

If sheetLoc$ = "" Then
Msgbox "The Excel sheet locaiton is mandatory. Please re-run the macro again"
Exit Sub
End If

Set dataSheet = GetObject(sheetLoc$ )

%REM
This check did not work
If dataSheet = VT_NULL Then
Msgbox "Notes could not find the specified file in the locaiton. Please re-run the macro again with correct locaiton and filename"
Exit Sub
End If
%END REM


' ==> Initialise progress bar. These functions are available in nnotesws.dll library
Dim hwnd As Long
hwnd = NEMProgressBegin(NPB_ONELINE)
NEMProgressSetText hwnd, "Please wait while data is processed", "Please wait"


rowCount = 2
maxCount = 1

' ==> Max number of rows, for the progress bar
While Not (dataSheet.Cells(maxCount,1).Value = "" )
maxCount = maxCount + 1
Wend

' ==> Process data from the Excel sheet. For every row, create a doc.
While Not (dataSheet.Cells(rowCount,1).Value = "" )
Set report = db.createdocument
report.Form = "Test"
' report.ComputewithForm True, False
report.Field1 = dataSheet.Cells(rowCount,1).Value
report.Field2 = dataSheet.Cells(rowCount,2).Value
report.Field3 = dataSheet.Cells(rowCount,3).Value
report.Field4 = dataSheet.Cells(rowCount,4).Value
report.Field5 = dataSheet.Cells(rowCount,5).Value
report.Field6 = dataSheet.Cells(rowCount,6).Value
report.Field7 = dataSheet.Cells(rowCount,7).Value
report.Field8 = dataSheet.Cells(rowCount,8).Value
report.Field9 = dataSheet.Cells(rowCount,9).Value
report.Field10 = dataSheet.Cells(rowCount,10).Value
report.Save True, False

NEMProgressSetBarPos hwnd, Clng(Int(rowCount*100/maxCount))

rowCount = rowCount + 1
Wend

' End Progress Bar
NEMProgressEnd hwnd

Exit Sub

errorhandle:
NEMProgressEnd hwnd


End Sub