Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using vb.net 2017 reading excel file 2016, into grid DataGridView

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
US
I am unable to install "Microsoft.ACE.OLEDB.12.0" I have Office 365 which is downloaded.
Anyway I found the following code which read the rows into an array. then I thought I would load that into the grid.
The issue is the dates in the array are numbers such as 43810 = 12/11/2109 and 43782 = 11/13/2019. How can I convert the number into its date?
TIA
Code:
'Load grid with excel data
            Dim application = New Excel.Application()
            Dim workbook As Excel.Workbook = application.Workbooks.Open(gblExcelFilename)
            Dim worksheet As Excel.Worksheet = workbook.Sheets(1)

            Dim usedRange = worksheet.UsedRange
            Dim usedRangeAs2DArray As Object(,) = usedRange.val

            'workbook.Save()
            workbook.Close()
            application.Quit()

DougP
 
Hi,

The underlying value for dates in Excel are numbers that represent the number of days from the base reference, Dec 31, 1899.

Check out this link:

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
"The most incomprehensible thing about the universe is that it is comprehensible" A. Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top