The following function gets a quote from Bloomberg.
The function works, when called from a Sub procedure, but not as a worksheet formula. Does anyone know why?
Public Function GetRatesSTATIC() As Variant
Application.DisplayAlerts = False
Dim objBK As Workbook
Dim objRng As Range
'Open the page as a workbook.
Set objBK = Workbooks.Open("http://www.bloomberg.com/quote/EURUSD:CUR")
'Find the Rate
Set objRng = objBK.Worksheets(1).Cells.Find("EURUSD:CUR")
'Retrieve the exchange rate.
GetRatesSTATIC = objRng.Offset(1, 0).Value
objBK.Close savechanges:=False
Application.DisplayAlerts = True
End Function
=FuncTest(A1)it runs the function provided with the value fromCell A1your function doesn't receive anything it only provides back.