Did you put it in a general module?
Are you calling that function from a sub in a different module?
If yes, remove the word Private from the Function definition statement.
Function WorkbookIsOpen(wbname) As Boolean
If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
John Baker wrote:
>
> Hi:
> Someone has given me a UDF which is coded as follows::
>
> Private Function WorkbookIsOpen(wbname) As Boolean
> ' Returns TRUE if the workbook is open
> Dim x As Workbook
> On Error Resume Next
> Set x = Workbooks(wbname)
> If Err = 0 Then WorkbookIsOpen = True _
> Else WorkbookIsOpen = False
> End Function
>
> I want to implement this so that it can be called for a sp[eciofic workbook. I have
> presently tucked it in the same area as the macros, but when I call it I get a errpr "Sub
> of Funcvtion undefined". The call is corrfect, but somehow the function isn't being
> excited.
>
> Can some one give me a step by step outline of how I record a functions such as this?
>
> Thanks
>
> John Baker
--
Dave Peterson