View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default opening file with worksheetfunction

Hi
a worksheet formula is not able to change the Excel
environment (e.g. changing formats or opening other
files). So this is not possible.

You may consider using the HYPERLINK formula. e.g.
=HYPERLINK("c:\etc\etc.xls")

or an alternative would be to use the worksheet_change
event to open another file

-----Original Message-----
Hello everybody.
I'm trying to create a worksheetfunction in Excel 97 that

should open
another excel-file.

This is how it looks now (in a module):

Public Function AZ (iUserInput as Integer) as Integer
workbooks.open "c:\etc\etc.xls"
AZ = iUserInput * 2
End Function

Now when I type in a worksheet in the same workbook
=AZ(3)
I get #VALUE!

The code simply doesn't open the file. On the other hand

it does work
when I start the function from the module. And I tested

it as a sub: it
worked. I have put the code in a worksheet event: it

worked again.

Why is it not possible to use a self-defined

worksheetfunction to open
a file?


---
Message posted from http://www.ExcelForum.com/

.