مجموعة من برامج جداول بيانات Microsoft مع أدوات لتحليل البيانات وتخطيطها وتوصيلها.
Please note that this is Arabic Q&A Forum, any threads should be posted in Arabic. However, I will still provide an answer on English based on your initial response.
Hi, fayez rawashdeh
Thanks for reaching out to Microsoft Q&A forum.
I appreciate your question. You can add function and argument help for a VBA UDF using Application.MacroOptions. This lets Excel show your description in the Insert Function (Fx) dialog and display argument names in the Function Arguments window, which are similar to built‑in functions. Inline “yellow bar” tooltips while typing are limited for VBA UDFs, but you can get close.
Here are the workarounds you can try to achieve this:
1) Define your UDF
' In a standard module
Public Function total(a As Double, b As Double) As Double
total = a + b
End Function
2) Register help text and argument descriptions
Run a small macro once (e.g., on Workbook_Open) to attach descriptions:
' In ThisWorkbook
Private Sub Workbook_Open()
' Register function metadata: description, category, and argument help
Application.MacroOptions _
Macro:="total", _
Description:="Returns the sum of a and b. Use for quick numeric totals.", _
Category:="User Defined", _
ArgumentDescriptions:=Array( _
"a: First addend (Double).", _
"b: Second addend (Double)." _
)
End Sub
``
Notes
- Description shows in the Insert Function dialog when users pick your UDF.
- ArgumentDescriptions appear in the Function Arguments dialog for your UDF.
- Category can be a built‑in category number or a string (creates a custom category).
If you don’t want it to run at open, you can execute the registration once from a normal macro. Excel persists these settings in the workbook, which then you don’t need to run the macro every time (but it applies per‑workbook, not globally).
- Get argument names into the formula quickly
While typing a formula, Excel won’t show a rich UDF tooltip like built‑ins, but it can insert argument placeholders:
- Type =total and press Tab > Excel enters =total(.
- Press Ctrl+Shift+> Excel inserts =total(a, b) so users see the parameters.
This is a handy way to mimic the guidance that the yellow bar gives for built‑in functions.
4) Optional: Link to a Help file
If you maintain a Help file, you can wire it up:
Application.MacroOptions _
Macro:="total", _
HelpFile:="C:\Path\to\YourHelp.chm", _
HelpContextID:=1001
This enables “Help on this function” from relevant UI surfaces.
5) Platform considerations (Windows vs. Mac)
Historically, Excel for Mac has partial support for Application.MacroOptions. The Fx dialog shows UDFs, but some metadata (category mapping, inline tips) can be inconsistent on certain versions; you may need to run the registration macro in each workbook and re‑open to see changes in Formula Builder.
6) What you cannot do with pure VBA
The inline yellow ScreenTip that shows syntax and argument descriptions for built‑in functions is not fully available to VBA UDFs. You’ll get the Insert Function/Arguments dialogs and the Ctrl+Shift+A placeholders, but not the same rich, dynamic tooltip while typing. For truly rich inline tooltips, you’d need an XLL/COM add‑in or newer extensibility approaches beyond VBA.
Hope this helps. Feel free to get back if you need further assistance.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment."
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.