E
ExcelMonkey
I am trying to create a new category for the function list in Excel and then
add a new UDF from one of my XLA addins to this list. I am in Excel 2003.
I have created the new function category by inserting an MS Excel 4.0 macro
sheet and going to INSERT/NAME/DEFINE. I then created created a name Test1.
I then clicked on Function under Macro, typed in the new function name
("MyFunctions")under the Category heading.
So now the category exists. I am having trouble adding the UDF to this or
any other list. The code I have for adding it to say the Text List is below.
I am getting an error message saying "Cannot edit a maro on a hidden
workbook. Unhide the workbook useing the Unhide Command." It stops on the
line of code:
Application.MacroOptions Macro:="VowelCount", Category:=7
Questions"
1) How do I unhide the xla to add the function?
2) What is the index number of my new category?
3) Is this number constant over time or is there risk that it could change?
Lastly, I have seen alot of posts in this newsgroyp that refer to this
issues by directing people to:
http://longre.free.fr/english/func_cats.htm
But this address does not seem to direct me to the info I am looking for. It
seems to go to the right site but most of it is in French and that which is
in english does not seem to answer my questions. I am not sure if the
orignal link has changed. Please let me know if I am wrong on this.
Thanks in advance.
"************************************************
'in Thisworkbook module
Private Sub Workbook_Open()
Application.MacroOptions Macro:="VowelCount", Category:=7
End Sub
'in regular module
Function VowelCount(r As String)
Count = 0
For i = 1 To Len(r)
Ch = UCase(Mid(r, i, 1))
If Ch Like "[AEIOU]" Then
Count = Count + 1
Debug.Print Ch, i
End If
Next i
VowelCount = Count
End Function
"******************************************************
add a new UDF from one of my XLA addins to this list. I am in Excel 2003.
I have created the new function category by inserting an MS Excel 4.0 macro
sheet and going to INSERT/NAME/DEFINE. I then created created a name Test1.
I then clicked on Function under Macro, typed in the new function name
("MyFunctions")under the Category heading.
So now the category exists. I am having trouble adding the UDF to this or
any other list. The code I have for adding it to say the Text List is below.
I am getting an error message saying "Cannot edit a maro on a hidden
workbook. Unhide the workbook useing the Unhide Command." It stops on the
line of code:
Application.MacroOptions Macro:="VowelCount", Category:=7
Questions"
1) How do I unhide the xla to add the function?
2) What is the index number of my new category?
3) Is this number constant over time or is there risk that it could change?
Lastly, I have seen alot of posts in this newsgroyp that refer to this
issues by directing people to:
http://longre.free.fr/english/func_cats.htm
But this address does not seem to direct me to the info I am looking for. It
seems to go to the right site but most of it is in French and that which is
in english does not seem to answer my questions. I am not sure if the
orignal link has changed. Please let me know if I am wrong on this.
Thanks in advance.
"************************************************
'in Thisworkbook module
Private Sub Workbook_Open()
Application.MacroOptions Macro:="VowelCount", Category:=7
End Sub
'in regular module
Function VowelCount(r As String)
Count = 0
For i = 1 To Len(r)
Ch = UCase(Mid(r, i, 1))
If Ch Like "[AEIOU]" Then
Count = Count + 1
Debug.Print Ch, i
End If
Next i
VowelCount = Count
End Function
"******************************************************