AliM67
AliM67

Reputation: 150

Clear argument descriptions of UDF using MacroOptions method

I used MacroOptions method to add descriptions for UDF. How to clear/unregister UDF descriptions?

This code works:

Application.MacroOptions Macro:=Fname, Description:=Empty, Category:=Empty

But this codes doesn't work:

Application.MacroOptions Macro:=Fname, Description:=Empty, Category:=Empty, ArgumentDescriptions:=Empty

Because of ArgumentDescriptions:=Empty , the code makes error 1004.

Upvotes: 1

Views: 373

Answers (2)

AliM67
AliM67

Reputation: 150

After some researches, I couldn't find any document how to Unregister the UDF descriptions. Finally I find a trick. To clear ArgumentDescriptions It doesn't need to know how many arguments is determined before. Below code clears all of them. Just should define an array with 1 empty element.

Dim arrEmpty(0)
Application.MacroOptions Macro:=Fname, Description:=Empty, Category:=Empty, ArgumentDescriptions:=arrEmpty

Upvotes: 0

FaneDuru
FaneDuru

Reputation: 42236

As described here, Macro, Description and Category are Variant parameters.

ArgumentDescriptions is an Array, containing descriptions of the UDF function arguments.

So, its value to cancel existing cannot be Emmpty!

Even if using:

 Application.MacroOptions Macro:=Fname, Description:=Empty, Category:=Empty

In order to also unregister ArgumentDescriptions you should use

 Application.MacroOptions Macro:=Fname, Description:=Empty, Category:=Empty, ArgumentDescriptions:=arrDescr

Where arrDescr was the array used to set ArgumentDescriptions when you registered it. Something like:

Dim arrDescr
arrDescr = Split("Description for first argument,Description for second argument,Descr for thirt one",",")

Application.MacroOptions Macro:="Fname", Description:="It does things", Category:=9, ArgumentDescriptions:=arrDescr

Upvotes: 1

Related Questions