troubleshooting Question

Excel Spreadsheet Giving Incorrect Time Value

Avatar of mitchvincent
mitchvincent asked on
Visual Basic.NET
1 Comment1 Solution242 ViewsLast Modified:
I have an excel spreadsheet that I'm grabbing data from. There is a field that contains a time string - "10:08:00 AM" for instance (I don't know if excel fiedls have a type or not).

A little code :

        Dim oExcel As Object
        Dim wbk As Object
        Dim a As String

        oExcel = CreateObject("Excel.Application")

        wbk = oExcel.Workbooks.Open(Filename:=TheExcelFile, UpdateLinks:=False, ReadOnly:=True)

        With wbk.ActiveSheet
            Debug.Writeline(.Range("C" & x.ToString()).Value)
        End With

Gives me "0.422222222222222" instead of "10:08:00 AM"

Does anyone know what the heck is going on there?

I can't do anything to change the spreadsheet because the client gets new ones sent to them daily, so I'm praying it isn't some kind of typing issue!

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 1 Comment.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros