I modified this from the _ExcelWriteFormula function to read the formula used in the B1 cell and return it. There's a ConsoleWrite of the returned value(s). ; ***************************************************************
; Example 1 - Write to a Cell using a Loop, after opening a workbook and returning its object identifier. Then enters a Forumula.
; *****************************************************************
#include <Excel.au3>
Local $oExcel = _ExcelBookNew() ;Create new book, make it visible
For $i = 0 To 20 ;Loop
_ExcelWriteCell($oExcel, $i, $i, 1) ;Write to the Cell
Next
_ExcelWriteFormula($oExcel, "=Average(R1C1:R20C1)", 1, 2) ;Uses R1C1 referencing
ConsoleWrite(_ExcelReadFormula($oExcel, 1, 2) & @CRLF) ;Uses R1C1 referencing
ConsoleWrite(_ExcelReadFormula($oExcel, "B1") & @CRLF)
MsgBox(0, "Exiting", "Press OK to Save File and Exit")
_ExcelBookSaveAs($oExcel, @TempDir & "Temp.xls", "xls", 0, 1) ; Now we save it into the temp directory; overwrite existing file if necessary
_ExcelBookClose($oExcel) ; And finally we close out
Func _ExcelReadFormula($oExcel, $sRangeOrRow, $iColumn = 1)
If Not IsObj($oExcel) Then Return SetError(1, 0, 0)
If Not StringRegExp($sRangeOrRow, "[A-Z,a-z]", 0) Then
If $sRangeOrRow < 1 Then Return SetError(2, 0, 0)
If $iColumn < 1 Then Return SetError(2, 1, 0)
Return $oExcel.Activesheet.Cells($sRangeOrRow, $iColumn).FormulaR1C1
Else
Return $oExcel.Activesheet.Range($sRangeOrRow).Formula
EndIf
EndFunc ;==>_ExcelWriteFormulaEDIT: There was an extra consolewrite in the function that I was using for debugging, it's been removed.