Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default UDF returns #value in XL97

It seems to be a problem with conversion:

Works in XL 97
Function GetStockQuote(Stock As String, _
Optional sWhatType As String, Optional sWhatDate As String) As Variant
sValue = rs.Fields(5).Value
End function


Returns #Value in XL 97
Function GetStockQuote(Stock As String, _
Optional sWhatType As String, Optional sWhatDate As String) As Variant
sValue = CDec(rs.Fields(5).Value)
End function

Why is that?

Clark



"Clark B" wrote in message
...
Hi there! I have problems with my UDF in XL97. In XL XP it works just fine
I have values stored in a recordset (not shown in code since it has low
relevance).
The name of the recordset is "rs". I filter the recordset and can match

the
correct
value to a given cell using application.caller.

To the problem: When I step through code I can se that the sValue has a
value on the second last row of the code.
But in cell I get just #Value. What could be wrong here? Corrupt metadata?

Best Regards

Clarkie

Function GetStockQuote(Stock As String, _
Optional sWhatType As String, Optional sWhatDate As String) As Variant

Dim sFilter as String
Dim sValue as Variant

sFilter = "Cell='" & Application.Caller.Address & "' AND Sheet='" &
Application.Caller.Parent.Name & _
"' AND WorkBook='" & Application.Caller.Parent.Parent.Name &

"'"

rs.Filter = sFilter
If rs.EOF = True Then
sValue = "Value not updated/found"
Else
If rs.Fields(5).Value < "Missing" Then
sValue = CDec(rs.Fields(5).Value)
Else
sValue = rs.Fields(5).Value
End If
End If

Msgbox sValue ' I do get a messagebox with a correct value here!
GetStockQuote = sValue

End Function





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
LEN function in XL97 Brian Excel Discussion (Misc queries) 5 May 19th 06 06:39 PM
XL97 changes filenames upon open CLR Excel Discussion (Misc queries) 5 December 6th 05 05:56 PM
XL97 vs XL? Recalc-time CLR Excel Discussion (Misc queries) 10 November 30th 05 01:57 PM
cannot open an xl97 file maxzsim Excel Discussion (Misc queries) 1 June 24th 05 12:29 PM
Function in xl2003 not working in xl97 Adam Excel Discussion (Misc queries) 2 January 26th 05 03:19 PM


All times are GMT +1. The time now is 05:24 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"