I am a very experienced VBA and Excel programmer. I have been using Excel 2003 and have an extensive add-in library, that I use Lorent Longre's free UDFCustomize.dll to automatically load a custom function category and provide the links to Help. My add-in functions look like and behave like any other Excel function.
Now, here comes XL 2010 (32-bit). Using it on W7 64-biit system. Trying to move away from the Lorent Longre solution because it does not work completely with XLSX files.
OK - no problem. MS has provided the Application.MacroOptions object to handle things the way I need them to. BUT, no matter what I try, I cannot get this thing to work. I even just wrote a little stub routine to plant a function into a custom category, just to understand how it works. No dice! It's so frustrating, because there is info all over the net on how this works, but I cant get it to work.
Here is what I have:
1) I have a small VBA code in the Workbook_Open event of the ADD-IN (an XLAM file called PetroUtil.xlam)
If I open Excel and a new workbook, I have confirmed that the ADD-IN loads and runs, and executes the AddFunc function.
But, looking at the function library, there is no PetroUtil category, and there is no function Months.
What am I doing wrong?
Now, here comes XL 2010 (32-bit). Using it on W7 64-biit system. Trying to move away from the Lorent Longre solution because it does not work completely with XLSX files.
OK - no problem. MS has provided the Application.MacroOptions object to handle things the way I need them to. BUT, no matter what I try, I cannot get this thing to work. I even just wrote a little stub routine to plant a function into a custom category, just to understand how it works. No dice! It's so frustrating, because there is info all over the net on how this works, but I cant get it to work.
Here is what I have:
1) I have a small VBA code in the Workbook_Open event of the ADD-IN (an XLAM file called PetroUtil.xlam)
Option Explicit
Private Sub Workbook_Open()
Excel.Application.OnTime VBA.Now() + VBA.TimeValue("00:00:00"), "AddFunc"
End Sub
2) The AddFunc subroutine is in a standard code module in the ADD-IN file PetroUtil.xlam, and it looks like this:Private Sub Workbook_Open()
Excel.Application.OnTime VBA.Now() + VBA.TimeValue("00:00:00"), "AddFunc"
End Sub
Public Sub AddFunc()
Excel.Application.MacroOptions Macro:="PetroUtil.xlam!Months", Category:="PetroUtil", Description:="This is a test"
End Sub
Note that I have fully qualified the Macro option, and I am using the Workbook_Open event to run the MacroOptions. I am putting the MacroOptions call in its own routine based on an error I get about modifying a hidden workbook, which internet posts pointed to the OnTime solution shown here.Excel.Application.MacroOptions Macro:="PetroUtil.xlam!Months", Category:="PetroUtil", Description:="This is a test"
End Sub
If I open Excel and a new workbook, I have confirmed that the ADD-IN loads and runs, and executes the AddFunc function.
But, looking at the function library, there is no PetroUtil category, and there is no function Months.
What am I doing wrong?