Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Extracting Excel Formulas into Access


I'm writing a program in Access that reads an entire Excel spreadshee
and breaks each cell down into data components for storage in
database. From here, there are modules I've written that will read th
tables I've created and then recreate the Excel spreadsheet in Excel.
(The reason for all this fun is that, in my line of work, we run a lo
of reports that export themselves to Excel so the user can do whateve
they want with them. It's better than providing a static report i
Access.)

Anyway, the issue I'm having is trying to read the formula from a cel
in Excel. Programmatically, it looks like this (pseudo-coded):

DBField = xlSht.Range(CellContent).Formula

The problem is that, even if it's a formula, it returns the text of th
cell instead of the formula. For example, if A1 = 1000 and B1 = A1*2
then the above code would process cell B1 as 2000 instead of th
formula that generated the content.

The helpfiles say that I'm doing it correctly (even going as far as t
point out that it will return the "=" from the formula). However, th
help file and reality appear to be two different things.

Anyone have a good take on what's going on? And, even better, how do
get the formula and not the result?

Thanks,

~No

--
Novelt
-----------------------------------------------------------------------
Novelty's Profile: http://www.excelforum.com/member.php...fo&userid=1570
View this thread: http://www.excelforum.com/showthread.php?threadid=27232

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 400
Default Extracting Excel Formulas into Access

I get the formula string in Excel 2000 using a syntax such as:

activeworkbook.Sheets(1).cells(1,2).Formula

If the target cell contains a value, the code returns the value of the cell.
Whether the cell has a formula can be determined by:

activeworkbook.Sheets(1).cells(1,2).HasFormula

This returns TRUE or FALSE.

"Novelty" wrote:


I'm writing a program in Access that reads an entire Excel spreadsheet
and breaks each cell down into data components for storage in a
database. From here, there are modules I've written that will read the
tables I've created and then recreate the Excel spreadsheet in Excel.
(The reason for all this fun is that, in my line of work, we run a lot
of reports that export themselves to Excel so the user can do whatever
they want with them. It's better than providing a static report in
Access.)

Anyway, the issue I'm having is trying to read the formula from a cell
in Excel. Programmatically, it looks like this (pseudo-coded):

DBField = xlSht.Range(CellContent).Formula

The problem is that, even if it's a formula, it returns the text of the
cell instead of the formula. For example, if A1 = 1000 and B1 = A1*2,
then the above code would process cell B1 as 2000 instead of the
formula that generated the content.

The helpfiles say that I'm doing it correctly (even going as far as to
point out that it will return the "=" from the formula). However, the
help file and reality appear to be two different things.

Anyone have a good take on what's going on? And, even better, how do I
get the formula and not the result?

Thanks,

~Nov


--
Novelty
------------------------------------------------------------------------
Novelty's Profile: http://www.excelforum.com/member.php...o&userid=15701
View this thread: http://www.excelforum.com/showthread...hreadid=272321


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extracting values from formulas servboss02 Excel Worksheet Functions 3 May 20th 08 07:14 PM
Excel formulas in Access KLKNOX Excel Worksheet Functions 0 March 7th 08 08:57 PM
My formulas can't 'see' numbers imported from Access in Excel, even when the format is the same. Chrism Excel Discussion (Misc queries) 4 April 12th 05 03:10 PM
Extracting Excel data and uploading to access JBP Excel Programming 1 January 23rd 04 07:42 PM
Extracting Access data Tom Brooks Excel Programming 0 July 8th 03 02:41 PM


All times are GMT +1. The time now is 09:41 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"