I am using Excel v16.9 on a mac running 10.13.3 and am trying to use the Evaluate function but it returns error Error 2015
.
The line that causes the error is:
temp = Evaluate(GetWebDataTest("https://query2.finance.yahoo.com/v10/finance/quoteSummary/IBM?modules=assetProfile", 269, 150))
When I step through the code, GetWebDataTest
is correctly evaluated but when the function ends the value is not returned to the variable test
instead it shows Error 2015
The value that GetWebDataTest
returns is:
"sector":"Technology","longBusinessSummary":"International Business Machines Corporation provides information technology (IT) products and services wo
Is this a bug with the Mac version of Excel or I am doing something wrong.
Update:
Upon further investigation of the problem, I have narrowed it down to Evaluate
not being able to return a string. Consider the following code:
temp = Evaluate(RetText())
temp1 = Evaluate(RetNo())
Public Function RetText() As String
RetText = "Te"
End Function
Public Function RetNo()
RetNo = 5
End Function
When run, temp
throw an error - Error 2029
whereas temp1
correctly is assigned the value 5.
It looks as though Evaluate
will fail if the resulting function tries to return a string.
Evaluate tries to execute whatever it is given as a formula - so it thinks TE should be a defined Name which it can't find.
Try this:
Public Function RetText() As String
RetText = "=""Te"""
End Function
or this
Public Function RetText() As String
RetText = """Te"""
End Function
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.