PC Review


Reply
Thread Tools Rate Thread

UDF How to record in Excel

 
 
John Baker
Guest
Posts: n/a
 
      2nd Jul 2006
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
 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      3rd Jul 2006
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
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Could someone tell me the difference between burning a UDF and a ISO/UDF DVD? Ron Cliburn DIY PC 2 17th Jan 2008 11:56 PM
Refer to a specific element of a UDF created array in another UDF? =?Utf-8?B?TGF1cmll?= Microsoft Excel Programming 3 20th Sep 2007 04:20 PM
UDF -> 256-Char -> UDF = "#VALUE!" Greg Lovern Microsoft Excel Programming 1 8th Sep 2006 08:22 AM
Passing a UDF as an argument to a UDF puff Microsoft Excel Misc 3 23rd Feb 2006 10:46 PM
UDF's using other UDF's millsy Microsoft Excel Worksheet Functions 9 18th Dec 2005 09:38 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:12 AM.