Gosh, you guys are fast. Sorry I won't be as fast - have to wait till I get home (complicated PC security at work reasons) before I can try this. Thanks!
Stuart
Main Topics
Browse All TopicsHi experts,
Previously you've helped me to export data from a Notes database into an Excel file. That worked great.
However now I'd like to do the reverse. I have a large Excel spreadsheet and I'd like to import each line into separate new forms in my database, which I'd like to create automatically as the import script runs. The form design already had fields to receive the data. Ideally I'd like to import into fields that can't be edited by the user to preserve data integrity.
Please can you get me started with the script needed?
Thanks,
Stuart
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
and also, chekc this link:
http://www.experts-exchang
Hai expers,
I have one database called salesio.nsf. in tht nsf i want to change all values of a particular field. (ie, stock_no,stock_name,rec_co
Business Accounts
Answer for Membership
by: madheeswarPosted on 2005-07-20 at 01:10:14ID: 14482246
Declarations:
Directory Path of Excel Sheets","Cleansing Import","c:\temp") r no.of rows to export","Importing no.of Rows","0") "
ewfornotes ")
Type ColStruc
FieldName As String
FieldDelimiter As String
End Type
Sub Initialize
'Call Terminate
Dim xlFilename As String
ExcelPath=Inputbox$("Enter
If (ExcelPath="c:\temp") Or (ExcelPath="") Then
Exit Sub
End If
ExcelPath1=Inputbox$("Ente
'// This is the name of the Excel file that will be imported
'xlFilename = "H:\Passport0600FinalB.xls
xlFilename=ExcelPath
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim row As Integer
Dim written As Integer
Set db = session.CurrentDatabase
Set doc = New NotesDocument(db)
'// Next we connect to Excel and open the file. Then start pulling over the records.
Dim Excel As Variant
Dim xlWorkbook As Variant
Dim xlSheet As Variant
Print "Connecting to Excel..."
Set Excel = CreateObject( "Excel.Application.8" )
Excel.Visible = False '// Don't display the Excel window
Print "Opening " & xlFilename & "..."
Excel.Workbooks.Open xlFilename '// Open the Excel file
Set xlWorkbook = Excel.ActiveWorkbook
Set xlSheet = xlWorkbook.ActiveSheet
'// Cycle through the rows of the Excel file, pulling the data over to Notes
Goto Records
Print "Disconnecting from Excel..."
xlWorkbook.Close False '// Close the Excel file without saving (we made no changes)
Excel.Quit '// Close Excel
Set Excel = Nothing '// Free the memory that we'd used
Print " " '// Clear the status line
Records:
row = 1 '// These integers intialize to zero anyway
written =0
Print "Starting import from Excel file..."
Do While True '// We use a test a few lines down to exit the loop
Finish:
With xlSheet
row = row + 1
Set view= db.GetView("assetlistingvi
Set doc = db.CreateDocument '// Create a new doc
doc.Form = "assets" 'Form name
'Update to Fields
doc.aclient_x = .Cells(row, 1).Value
doc.alocation_x = .Cells( row, 2).Value
doc.aslno_x = .Cells( row, 3).Value
doc.adesc_x = .Cells(row, 4).Value
doc.aquantity_x = .Cells(row, 5).Value
doc.assetshost_x="Yes"
doc.arem_x=""
doc.ajobno_x=""
doc.dbpath=""
doc.Escape="OK"
doc.client_x=.Cells(row, 1).Value
Call doc.Save( True, True ) '// Save the new doc
written = written + 1
k=k+1
'Below line is cool, will print the doc being imported'
Print"Document Created:"+Cstr(k)
If ExcelPath1= written Then
Goto Done
Else
Goto Finish
End If
' If written = 1000 Then
' Print written
' Print written & " Documents Imported"
' Goto Done
' Else
' Goto Finish
' End If
End With
Print written & " records imported...", doc.assetsjobno_x(0)
Loop
Return
Done:
End Sub
Place this in an agent and call it in a Action button