View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ryan Poth[_3_] Ryan Poth[_3_] is offline
external usenet poster
 
Posts: 3
Default Calling functions from Excel worksheets and the Find function in XL '97

Mike,

Excel does mot allow you to change spreadsheet data from
within a Function. This sort of activity must be done via
a Sub instead. Although I haven't personally tested your
case, I believe that limitation includes opening files.

HTH
Ryan

-----Original Message-----
Can anyone tell me what the limitations of calling public

functions from an
Excel worksheets is?

I've picked up using UDFs as a method of conditional

formatting (as Jake
Marx suggested to me in an earlier post,) but it seems

they can't accomplish
everything I want them to do.

For instance, suppose my code looks like this:

=NOT(Findvar()) (<---The conditional formatting

formula)


Private Function Findvar() as Boolean

Workbooks.open "F:\Database.xls"

Findvar = MsgBox("Test", vbOKCancel, "Test")


When data is entered into the cell (and oddly enough,

sometimes when you
click next to it,) the msgbox is displayed and the cell's

formating is
changed correctly according to the results, but Excel

doesn't even attemp to
open the workbook. It seems many other things I can

include in the function
won't be executed either. Any help with this would be

much appreciated!



Also, there is no information on the VBA function .Find

in my help files. If
someone could tell me about it's usage, mainly about what

data type it
returns, I would appreciate that as well.

TIA
Mike-hime


.