working on a Notes database...one of its function is...that user will be able to import the Excel files.
Following is the code i am using to import the Excel files into Lotus Notes database...i found this on the web and alter it a bit for my needs.
so far...as far as my testing goes it is working fine. However i am not sure that how come i am getting the correct Date values. Please allow me to explain further.
Excel file that i am using for testing...in it couple of columns have Date values (i have set the format for all the cells in these columns as Date). And then using the code below...importing the Excel file in the Lotus Notes Db. And along with other values...getting the correct Date values from the Excel file. Even when i change the cell format of the Date e.g. (13-Dec-07 or September 19, 2008 or 11/26/08) i got the correct Date values in the Lotus Notes Db. i think what i am saying is that how the code below knows what is the month and what is the day from different cell formats that i have in the Excel file. The one thing that i found that even if i have different cell formats e.g. (13-Dec-07 or September 19, 2008 or 11/26/08) in the formula bar of the Excel it always shows as mm/dd/yyyy (is this is due to the control panel -> regional setting? and is this is why even with different cell formats i am getting the correct date values?)
what i like to make sure is this that when user will use the Lotus Notes Db and import their generated Excel files, how to ensure that the code below import the correct Date values
from the user Excel files. (like what if user does not format the column and its cells as Date, what if in the user Excel file the Date value stored as text or something). i do not know how?...may be some kind of check in the following code to make sure that the Date Values from Excel files will be imported correctly.
Following are the lines from the code below...where i am reading it from the Excel and storing it in the Date fields on the form.
cur_doc.Datefield1 = rs.Fields(8).value
cur_doc.Datefield2 = rs.Fields(9).value
Sorry if it seems like a long story but i like to give as much related info as i can. Need your help.
30 day free trial. Cancel anytime.
Learn More about How It Works