I made my own user defined function to act as a test function for me
to try some stuff out in a sub that is being ran from a button.
My test function is
Function testFunc() As Integer
On Error GoTo errhandler
ActiveWorkbook.Names.Add Name:="ZOMGNAME", RefersTo:="=Sheet1!X20"
testFunc = 1
errhandler:
MsgBox Err.Description
End Function
The error I get is application-defined or object-defined error
The function exists in the workbooks Module1 module
Why am I getting the error?
Thanks in advance
Dave Peterson - 20 Sep 2007 20:31 GMT
You don't have any cell that contains a formula that tries to use this function,
right?
I couldn't duplicate the error as long as I had a worksheet named Sheet1 in my
activeworkbook.
ps. You may want to avoid the errhandler if there is no error.
Option Explicit
Function testFunc() As Integer
On Error GoTo errhandler
ActiveWorkbook.Names.Add Name:="ZOMGNAME", RefersTo:="=Sheet1!X20"
testFunc = 1
Exit Function
errhandler:
MsgBox Err.Description
End Function
> I made my own user defined function to act as a test function for me
> to try some stuff out in a sub that is being ran from a button.
[quoted text clipped - 16 lines]
>
> Thanks in advance

Signature
Dave Peterson