Somewhere I read that if you want a sub or function to be available to all of your programs, you should put it in Personal.xls. Okay, I put the following in my Personal.xls file under Modules.

Public 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 If

End Function


In another file I attempt to use the function, but I get Compile Error: Sub or Function not defined.

wbopen = WorkbookIsOpen("File Name.xls")
If wbopen <> True Then
Workbooks.Open Filename:="C:\File Cabinet\Recon\File Name.xls"
End If


Can any tell me what I am doing wrong or what else I need to do to get this to work or a better method altogether. I use this function a lot and up to this point I have simply put it in file due to lack of time to research a better way. Now that I have discovered this list I have finally finded the resource I need to improve my programming skills.

Thanks!