+ Reply to Thread
Results 1 to 9 of 9

Using ADO to read closed file does not read formulas

  1. #1
    Registered User
    Join Date
    02-16-2010
    Location
    Dallas
    MS-Off Ver
    Excel 2007
    Posts
    23

    Arrow Using ADO to read closed file does not read formulas

    First of all, thanks for all the great help and quick responses, this place has been invaluable!

    I'm using ActiveX Data Objects to gain access to another closed .xlsm excel file. Mainly to read large ranges of information at one time. The problem I am running into is the information that is returned is basically the .value of of the cells, not the .formula of the cells. I know very little of what is really going on with the connection strings and the ADO object, but I have been able to modify other people's code, and read up quite a bit on it to produce what I have below. There may not be a solution to this, but is there some way to modify the properties string to return the .formula information, or anything else that can be done? Below is the code I have put together. It takes a file path, and a worksheet name to return every non empty cell value as a two dimensional array.

    Please Login or Register  to view this content.
    Last edited by treyr; 06-09-2010 at 11:11 AM.

  2. #2
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Using ADO to read closed file does not read formulas

    I'm afraid not. The provider has no concept of formulas, only values.
    Remember what the dormouse said
    Feed your head

  3. #3
    Registered User
    Join Date
    02-16-2010
    Location
    Dallas
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Using ADO to read closed file does not read formulas

    Ah, really? Thanks for clearing that up then.

    Any suggestions on how to read the formula's of large ranges in other workbooks then?

  4. #4
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Using ADO to read closed file does not read formulas

    Open it, dump the formulas into an array and then close the workbook. Why do you need the formulas rather than the values as a matter of interest?

  5. #5
    Registered User
    Join Date
    02-16-2010
    Location
    Dallas
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Using ADO to read closed file does not read formulas

    I will have several excel "data" files containing lots projects, each project will potentially have up to 25 names, their discipline, and their city. I then have a master file that will read and house all the project information from all the files. However only the initials should be seen in these files and I have written a simple formula to display only the first letter of each word. The formula also contains the discipline and city but does not make any use of this information (looks like =GetInit("Trey Roger Ruiz", "Electrical" , "Dallas") which displays "TRR" in the cell). So at the moment, the master file reads the data files, but only reads the initials, not the whole name, discipline, or city that is contained in the cells. Problem is the data files will be excel files on the local servers in cities all over the US. I was trying to avoid opening files as read only as this seems slower than the ADO data connection. GuessI have no other choice...

  6. #6
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Using ADO to read closed file does not read formulas

    Well, that is one very good reason for not hardcoding data into formulas, unfortunately.

  7. #7
    Registered User
    Join Date
    02-16-2010
    Location
    Dallas
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Using ADO to read closed file does not read formulas

    Agreed.

    Btw, do you know of a good way to dump everything in a sheet into an array?

  8. #8
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Using ADO to read closed file does not read formulas

    If you want values:
    Please Login or Register  to view this content.
    or formulas:
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    02-16-2010
    Location
    Dallas
    MS-Off Ver
    Excel 2007
    Posts
    23

    Re: Using ADO to read closed file does not read formulas

    So much simpler than the route I was pursuing.

    Thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1