Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

defining variables in function

  Asked By: Kiral    Date: Dec 15    Category: MS Office    Views: 817
  

I am using user defined functions in my excel files. By defining the
the property in member options as definition I can write an
explanation what function do while using the function. However I
can't see how the parameters are defined. If someone could help me
how I can define those I will be glad.

For example
function celcius(degree)
if I clicked the function button, a help file open and gives its
description as it converts fahrenheit to celcius.
However when I clicked in the degree part I want the description
change and write : you will write the number here.
How can I do this.

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Laurel Collins     Answered On: Dec 15

my Add-in contains a function

Function DStr(Date_Value As Date) As String
..
End Function

In the module "ThisWorkbook" I have the following procedure:

Private Sub Workbook_Open()
...
Application.MacroOptions Macro:="DStr", Category:=2, _
Description:="Converts Microsoft Excel's date format to a text string
'mmm dd, yyyy'.", _
HelpContextID:=HID, HelpFile:=ELP + FHlp
End Sub

This code does the following:
* assigns my functions  to category 2 which is "Date & Time" (by default your
function is assigned to the category "User Defined")
* it adds the above description to the "Insert Function" window.
* HID is the assigned number  in my help  file to describe the function  when
clicking help
* ELP is the path where my help file  is (Excel Library path) and defined  earlier
in the code:
ELP = Application.LibraryPath & Application.PathSeparator
* FHlp is the name of the help file defined as a public constant:
Public Const FHlp = "wqn.hlp" 'File: Help

 
Didn't find what you were looking for? Find more on defining variables in function Or get search suggestion and latest updates.




Tagged: