Sign in to follow this  
Followers 0
wimhek

Excel UDF read formula

13 posts in this topic

Hi

I am using the ExcelCom_UDF, where I read data from an excel sheet.

I cannot get the result of a formula. Is there a way to fetch this ?

.

Share this post


Link to post
Share on other sites



Try this:

#Include <Excel.au3>
$oExcel = _ExcelBookOpen(@ScriptDir & "\grafic.xls", 0);file not visible
$sCellValue = _ExcelReadCell($oExcel, 4, 3);row 4, col 3 (C4)
MsgBox(0, "", "The Cell Value is: " & @CRLF & $sCellValue, 2)
_ExcelBookClose($oExcel)

Share this post


Link to post
Share on other sites

I still got an empty result.

For your info, the cell contains :

=NETWORKDAYS(NOW();L7)

(L7 contains 30-04-2010)

Share this post


Link to post
Share on other sites

The above works for me. It returns -21.

Did you point _ExcelReadCell to the correct cell?

(I did have to add $oExcel.Quit to properly close Excel though, but that's another issue)

Share this post


Link to post
Share on other sites

The above works for me. It returns -21.

Did you point _ExcelReadCell to the correct cell?

(I did have to add $oExcel.Quit to properly close Excel though, but that's another issue)

Hmm maybe I am using the wrong UDF version

If I change the cell in 'normal data', I see the content.

Share this post


Link to post
Share on other sites

WIMHEK....HELP!

I have the opposite problem. When I read a cell, I get the value, I want the formula.

How do I get the formula? How did you get it?

Henry

Hi

I am using the ExcelCom_UDF, where I read data from an excel sheet.

I cannot get the result of a formula. Is there a way to fetch this ?

.

Share this post


Link to post
Share on other sites

Try

$sFormula = $oExcel.Activesheet.Range("A1").Formula

Share this post


Link to post
Share on other sites

How can I find more information about working with Excel this way:

$oExcel.Activesheet.Range("A1").Formula

That will work for me. I also want to do more...

Share this post


Link to post
Share on other sites

It makes use of the COM interface of excel. MSDN has lots of information on it.

Share this post


Link to post
Share on other sites

Try taietel's solution in post #2.

Your formula seems to be at fault? ";" should be a ","


Share this post


Link to post
Share on other sites

Try taietel's solution in post #2.

Your formula seems to be at fault? ";" should be a ","

I don't think so.

Using dutch excel "=NETTO.WERKDAGEN(NU();L7)" works, while "=NETTO.WERKDAGEN(NU(),L7)" tells me there is an error in my formula.

Share this post


Link to post
Share on other sites

I don't think so.

Using dutch excel "=NETTO.WERKDAGEN(NU();L7)" works, while "=NETTO.WERKDAGEN(NU(),L7)" tells me there is an error in my formula.

See attached from the help screen. Wonder if it would be a language thing?

post-59986-12869557408262_thumb.jpg


Share this post


Link to post
Share on other sites

I did a test and getting the correct answer.

#Include <Excel.au3>
$oExcel = _ExcelBookOpen(@desktopdir & "\test.xls", 0);file not visible
$sCellValue = _ExcelReadCell($oExcel, 4, 3);row 4, col 3 (C4)
MsgBox(0, "", "The Cell Value is: " & @CRLF & $sCellValue, 2)
_ExcelBookClose($oExcel)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0