将帮助添加到“无可用帮助”Excel、VBA、用户定义的函数

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10987037/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 16:27:42  来源:igfitidea点击:

Add help to "No help available" Excel, VBA , User defined functions

excel-vbaexcel-2007user-defined-functionsvbaexcel

提问by Siddharth Rout

I was trying to add some help to my user-defined function(UDF) in Excel, written using VBA(Visual Basic for Applications). I know how to add a description.Any idea how I can add help at the blue link "Help on this function" and not have it lead to a MsgBox that reads "No help available" ?

我试图在 Excel 中为我的用户定义函数(UDF)添加一些帮助,使用 VBA(Visual Basic for Applications)编写。我知道如何添加描述。知道如何在蓝色链接“有关此功能的帮助”中添加帮助,而不是让它指向显示“无可用帮助”的 MsgBox 吗?

回答by Siddharth Rout

You have to first create a help file. You can then use Application.MacroOptionsto attach the help file to the function

您必须首先创建一个帮助文件。然后您可以使用Application.MacroOptions将帮助文件附加到函数

For example

例如

Application.MacroOptions Macro:="MyFunction", _
                         Category:="My Custom Category", _
                         HelpFile:="C:\MyHelp.chm", _
                         HelpContextID:=1

EDIT: Adding More Information

编辑:添加更多信息

I usually use Help and Manual6to create my help files for my projects. Here is one example that I created for the above example. And when I click on the "Help On this Function", see what do I get...

我通常使用Help 和 Manual6为我的项目创建帮助文件。这是我为上述示例创建的一个示例。当我点击“关于此功能的帮助”时,看看我会得到什么......

enter image description here

在此处输入图片说明

DISCLAIMER: I am not connected to Help and Manual6in any way but I like their product (It is not free). You might just find a freeware on the web which can make chm files for you so I leave the decision with you on how you choose to make the help file.

免责声明:我没有以任何方式连接到Help 和 Manual6,但我喜欢他们的产品(它不是免费的)。您可能会在网上找到一个免费软件,它可以为您制作 chm 文件,因此我将决定您如何选择制作帮助文件。