![]() |
Explaining an addin
How do I define the arguments in an Excel Addin function that I created? When I bring up a built in Excel function
it does have an expalantion of the arguments. How do I do it for my add-ins? I 'm using Office 2003. |
Explaining an addin
Let's learn by examples! Below are two custom worksheet functions created using VBA
The first example is a simple function for finding out whether a specific year is a leap year. Observe the syntax for the use of arguement, and also the definition of the value type for the function. (Here, the function returns a Boolean value, either TRUE or FALSE. '------------------------------------------------ Function ISLEAPYEAR(ByVal year_input as integer) As Boolea If year_input Mod 4 < 0 The ISLEAPYEAR = Fals ElseIf year_input Mod 400 = 0 The ISLEAPYEAR = Tru ElseIf year_input Mod 100 = 0 The ISLEAPYEAR = Fals Els ISLEAPYEAR = Tru End I End Functio '------------------------------------------------ The second example finds out the "standard font" defined in Excel. Here, there is an "Optional Arguement". See the syntax and how to define a "default value" for the optional arguement '------------------------------------------------ Function STDFONT(Optional show_size As Boolean = False) As Strin 'the optional arguement decides whether the standard font size is also shown STDFONT = Application.STANDARDFON If show_size = True Then STDFONT = STDFONT & " " & Application.STANDARDFONTSIZE & "pt End Functio '------------------------------------------------ Also, you may have a look at the Excel VBA on-line help. Look for the key word "Function statement" ----- EMR Tech wrote: ---- How do I define the arguments in an Excel Addin function that I created? When I bring up a built in Excel functio it does have an expalantion of the arguments. How do I do it for my add-ins? I 'm using Office 2003 |
Explaining an addin
This basically isn't supported in VBA.
You might look at some of the work Laurent Longre has done on this. The second reference is his newest: http://longre.free.fr/english/func_cats.htm the above appears to be a special case and only works with two arguments - from what I have heard. http://longre.free.fr/english/index.html#FunCustomize -- Regards, Tom Ogilvy "EMR Tech" wrote in message ... How do I define the arguments in an Excel Addin function that I created? When I bring up a built in Excel function it does have an expalantion of the arguments. How do I do it for my add-ins? I 'm using Office 2003. |
All times are GMT +1. The time now is 09:56 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com