Skip to main content
 
developerWorks
AIX and UNIX
Information Mgmt
Lotus
New to Lotus
Products
How to buy
Downloads
Live demos
Technical library
Training
Support
Forums & community
Events
Rational
Tivoli
WebSphere
Java™ technology
Linux
Open source
SOA and Web services
Web development
XML
My developerWorks
About dW
Submit content
Feedback



developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum

developerWorks

  

Sign in to participate PreviousPrevious NextNext


lathan reddy 17.Aug.12 11:47 AM a Web browser
Domino Designer 7.0.1 Windows XP


I need to import the data from excel file.
In the Excel file I have around 15 columns, but I wanted two to import only 3 Columns (Column B, Column J, and Column N) columns data needs to be import, that I did without any issues.
Code Below Mentioned:

Dim session As New NotesSession
Dim wks As New NotesUIWorkspace
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim row As Integer
Dim written As Integer
Dim xFilename As Variant

Set db = session.CurrentDatabase
xFileName = wks.OpenFileDialog(False,"Select an excel file to import.","Microsoft Office Excel Workbook|*.xls","C:\")
If Isempty(xFileName) Then

Msgbox "You have cancelled the import process.",64,"Import Cancelled"
Else
Msgbox "Starting import from file " + xFileName(0),64,"Initiating Import"

Dim Excel As Variant
Dim xlWorkbook As Variant
Dim xlSheet As Variant
Print "Connecting to Excel..."


Set Excel = CreateObject("Excel.application")
Excel.Visible = False
Set xlWorkbook = Excel.Workbooks.Open(xFileName)
Set xlWorkbook = Excel.ActiveWorkbook
Set xlsheet=xlWorkbook.ActiveSheet
Print "Starting import from Excel file..."
Dim NumberOfRows As Long
NumberOfRows = xlSheet.UsedRange.Rows.Count
row =0
written =0
row = row +1
Set doc = db.CreateDocument
Set doc = Nothing

For row =8 To NumberOfRows

With xlSheet
Set doc = db.CreateDocument
doc.Form = "Employee"
Call doc.ComputeWithForm(False,False)
doc.EmployeeID= .Cells(row,2).Value
doc.EContact= .Cells(row,14).Value
doc.EDesig= .Cells(row,10).Value

Call doc.save(True,True)
written = written + 1
row = row + 0
If row = NumberOfRows +1 Then
Goto Done
Else
End If
Print written & "records imported..."
End With
Next

Done:
Print "Disconecting from Excel..."
xlWorkBook.close False
Excel.quit
Set Excel = Nothing
Print " "
End If
Exit Sub


Here my problem is if they modify the columns in excel sheet weekly or monthly or if they delete the column A, then that case all rest of the column order will change right? For example: Earlier it was Column D now it is Column C (Because, Column A Is deleted from the excel sheet due to that reason other column order will be change).

Is there any way to provide the permission to the user (is there any way to prompt message to the end user to import correct data with mismatch (or) is there any configuration settings we can do?) if the user change the Column H to Column Y then that case column Y Data needs to be import form excel sheet to lotus notes database view.

please help me some one to do the above functionality.Thanks!!






Import From Excel problem (would ha... (lathan reddy 17.Aug.12)
. . RE: Import From Excel problem (woul... (Jerry Redman 19.Aug.12)
. . . . RE: Import From Excel problem (woul... (lathan reddy 21.Aug.12)
. . . . . . RE: Import From Excel problem (woul... (Carl Tyler 21.Aug.12)
. . . . . . RE: Import From Excel problem (woul... (Jerry Redman 21.Aug.12)





  Document options
Print this pagePrint this page

 Search this forum

  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Author
Category
Platform
Release
Advanced search

 Sign In or Register
Sign in
Forgot your password?
Forgot your user name?
Create new registration

 RSS feedsRSS
All forum posts RSS
All main topics RSS
More Lotus RSS feeds

Resources

 Resources
Forum use and etiquette
Native Notes Access
Web site Feedback

Lotus Support

 Lotus Support
IBM Support Portal - Lotus software
Lotus Support documents
Lotus support by product
Lotus support downloads
Lotus support RSS feeds

Wikis

 Wikis
IBM Composite Applications
IBM Mashup Center
IBM Connections
IBM Docs
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud for Social Business
IBM Web Experience Factory
Lotus Domino
Lotus Domino Designer
Lotus Expeditor
Lotus Foundations
Lotus iNotes
Lotus Instructor Community Courseware
Lotus Notes
Lotus Notes & Domino Application Development
Lotus Notes Traveler
Lotus Protector
Lotus Quickr
Lotus Symphony
IBM Web Content Manager
WebSphere Portal

Lotus Forums


 Lotus Forums
Notes/Domino 9.0
Notes/Domino 8.5 + Traveler
Notes/Domino XPages development forum
Notes/Domino 8
Notes/Domino 6 and 7
Notes/Domino 4 and 5
IBM Connections
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud Notes
IBM SmartCloud Meetings
IBM Web Content Manager
Lotus Domino Document Manager
Lotus e-learning
Lotus Enterprise Integration
Lotus Expeditor
Lotus Protector
Lotus Quickr
Lotus SmartSuite
Lotus Symphony
Lotus Symphony Developer Toolkit Support
Lotus Workflow