Null Values From Retrieved Spreadsheet Data

  • I have a vba macro written in an excel worksheet (WS1) that reads another excel file (WS2) and retrieves data and writes it into the worksheet with the macro (WS1). It works beauifully except for one little problem. When I send it to a co-worker the numbers part of the data returns null values. I am connecting to (WS2) using ADO connection strings for the spreadsheet and recordset. The only difference I see is that in references of WS1, it shows Microsoft ActiveX Data Objects 2.7 library, it shows 2.8 library on my machine. Also it shows recordset 2.8 library on my coworkers machine, as well as mine. Any ideas would be GREATLY appreciated.

  • Re: Null Values From Retrieved Spreadsheet Data


    I suppose it could be related to the different versions of Excel, as it appears (?) that you suspect.


    Have you tried stepping through (hitting F8 repeatedly while in the module) the code under your co-worker's log-in on his computer to see what is happening to the values as they transfer? That would be where I'd start.


    If your co-worker doesn't have access to all the directories that you do, it might also cause the problems retrieving values. Have him try opening the workbooks that the sheet references. If that's the problem, you could simply copy the sheets that are referenced to a directory that he can access.


    It's really hard to guess here with what little you've provided. What's the code you're using that causes the values to return?

  • Re: Null Values From Retrieved Spreadsheet Data


    I have stepped through the code on his laptop. I researched it some more and it appears to be a difference in data types. According to the MSDN website, it will evaluate a row and determine data types. If it comes across data within the column that is, say, a number of 1.435, but it had determined that to be a text column, it will return a null value. It is only the columns with numbers in it and when I look at the top of the spreadsheet, there are cells with text in them (headers & what not). They suggested using the 'IMEX=1' in my connection string but when I did that, it could not load the ISAM reference. Again, I don't know why it works on mine? I appreciate the feedback and if you have any other ideas, please let me know.

  • Re: Null Values From Retrieved Spreadsheet Data


    I'm sorry, I was asked to provide the code I am using and I omitted that piece of info. The code I am using is as follows:



    Where sSql1 is a value in a list I am using to look up the correspoding record. Any thoughts??

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!