+ Reply to Thread
Results 1 to 8 of 8

Custom Categories for UDF

Hybrid View

  1. #1
    Registered User
    Join Date
    02-10-2011
    Location
    Denmark
    MS-Off Ver
    Excel 2010 & Windows 7
    Posts
    23

    Custom Categories for UDF

    I have made different functions and I would like to have them in four different custom categories by using the following:
    Application.MacroOptions macro:="Interpolation", Description:="Liniar Interpolation ", Category:="Interpol"
    Application.MacroOptions macro:="Lagrange", Description:="Lagrange Interpolation ", Category:="Interpol"
    Application.MacroOptions macro:="inter_2_poly", Description:="2nd Degree Polynomia Interpolation (X: Lo to Hi) ", Category:="Interpol"
    Application.MacroOptions macro:="inter_2_poly_back", Description:="2nd Degree Polynomia Interpolation (X: Hi to Lo) ", Category:="Interpol"
    Application.MacroOptions macro:="Ra_spline2", Description:="Ra_spline2 ", Category:="Interpol"
    '
    Application.MacroOptions macro:="KQ", Description:="Calculation of KQ for open propeller ", Category:="B-serie"
    Application.MacroOptions macro:="KT", Description:="Calculation of KT for open propeller ", Category:="B-serie"
    Application.MacroOptions macro:="PD_KQ", Description:="Calculation of P/D based on KQ for open propeller ", Category:="B-serie"
    Application.MacroOptions macro:="PD_KT", Description:="Calculation of P/D based on KT for open propeller ", Category:="B-serie"
    Application.MacroOptions macro:="J_KT_J2", Description:="Calculation of J based on KT/J2 for open propeller ", Category:="B-serie"
    Application.MacroOptions macro:="J_KT_J4", Description:="Calculation of J based on KT/J4 for open propeller ", Category:="B-serie"
    Application.MacroOptions macro:="J_KQ_J3", Description:="Calculation of J based on KQ/J3 for open propeller ", Category:="B-serie"
    Application.MacroOptions macro:="J_KQ_J5", Description:="Calculation of J based on KQ/J5 for open propeller ", Category:="B-serie"
    '
    Application.MacroOptions macro:="Kq_Ka", Description:="Calculation of KQ for nozzle propeller ", Category:="Ka-serie"
    Application.MacroOptions macro:="Ktt_Ka", Description:="Calculation of KTT for nozzle propeller ", Category:="Ka-serie"
    Application.MacroOptions macro:="Ktn_Ka", Description:="Calculation of KTN for nozzle propeller ", Category:="Ka-serie"
    Application.MacroOptions macro:="PD_Kq_Ka", Description:="Calculation of P/D based on KQ for nozzle propeller ", Category:="Ka-serie"
    Application.MacroOptions macro:="PD_Ktt_Ka", Description:="Calculation of P/D based on KTT for nozzle propeller ", Category:="Ka-serie"
    Application.MacroOptions macro:="J_KTT_J2_KA", Description:="Calculation of J based on KTT/J2 for nozzle propeller ", Category:="Ka-serie"
    '
    Application.MacroOptions macro:="KQ_B4_70_19A", Description:="Calculation of KQ for B4.70 in 19A nozzle ", Category:="B4_70_19A"
    Application.MacroOptions macro:="KTT_B4_70_19A", Description:="Calculation of KTT for B4.70 in 19A nozzle ", Category:="B4_70_19A"
    Application.MacroOptions macro:="KTN_B4_70_19A", Description:="Calculation of KTN for B4.70 in 19A nozzle ", Category:="B4_70_19A"
    Application.MacroOptions macro:="PD_KQ_B4_70_19A", Description:="Calculation of P/D based on KQ for B4.70 in 19A nozzle ", Category:="B4_70_19A"
    Application.MacroOptions macro:="PD_KTT_B4_70_19A", Description:="Calculation of P/D based on KTT for B4.70 in 19A nozzle ", Category:="B4_70_19A"
    It works, but when I close Excel and open it again the functions are either in the B-serie category or in the user_defined category. I have the made a macro in my personal with the code above and associated it to a button. When I run the macro I can see all four categories with functions in the correct categories however when I close and open excel once more the problem is still there. What do I do wrong?

    This is my first post so if it is in the wrong place sorry in advance.

    Best regards
    EEL1966
    Last edited by EEL1966; 02-12-2011 at 10:09 AM. Reason: tags

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,996

    Re: Custom Categories for UDF

    You need to call that code from the Workbook_Open event (in the ThisWorkbook module) of your workbook so that it gets run automatically when the workbook opens.
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Registered User
    Join Date
    02-10-2011
    Location
    Denmark
    MS-Off Ver
    Excel 2010 & Windows 7
    Posts
    23

    Re: Custom Categories for UDF

    Thank you for your reply.

    I have tried it and it seems to work. I have placed the following macro in "ThisWorkbook".
    Private Sub Workbook_Open()
        On Error GoTo 0
        Application.ScreenUpdating = False
        ThisWorkbook.IsAddin = False
        '
        Application.MacroOptions macro:="KQ_B4_70_19A", Description:="Calculation of KQ for B4.70 in 19A nozzle ", Category:="B4_70_19A"
        Application.MacroOptions macro:="KTT_B4_70_19A", Description:="Calculation of KTT for B4.70 in 19A nozzle ", Category:="B4_70_19A"
        Application.MacroOptions macro:="KTN_B4_70_19A", Description:="Calculation of KTN for B4.70 in 19A nozzle ", Category:="B4_70_19A"
        Application.MacroOptions macro:="PD_KQ_B4_70_19A", Description:="Calculation of P/D based on KQ for B4.70 in 19A nozzle ", Category:="B4_70_19A"
        Application.MacroOptions macro:="PD_KTT_B4_70_19A", Description:="Calculation of P/D based on KTT for B4.70 in 19A nozzle ", Category:="B4_70_19A"
        '
        ThisWorkbook.IsAddin = True
        Application.ScreenUpdating = True
    End Sub
    However when I closes Excel I get the following question in a Yes/No/Cancel box:

    Do you want to save the changes you have made to 'B4-70 19A.xlam'?


    I have tried to get rid of the question with the following macro in "ThisWorkbook".
    Private Sub Workbook_Close()
        On Error GoTo 0
        Application.ScreenUpdating = False
        ThisWorkbook.IsAddin = False
        Workbooks("B4-70 19A.xlam").Close savechanges:=False
        ThisWorkbook.IsAddin = True
        Application.ScreenUpdating = True
    End Sub
    This does not work. How do I get rid of the question?

    Best regards
    EEL1966
    Last edited by romperstomper; 02-11-2011 at 08:56 AM. Reason: add code tags

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,996

    Re: Custom Categories for UDF

    Probably because you keep changing the IsAddin property.

    Note: when posting code on the forum, you must use code tags, please. I've added them for you again as it's only your second post, but please learn to use them in future.

  5. #5
    Registered User
    Join Date
    02-10-2011
    Location
    Denmark
    MS-Off Ver
    Excel 2010 & Windows 7
    Posts
    23

    Re: Custom Categories for UDF

    With regard to the code tag I will remember that, sorry.

    I have to change the IsAddin property in the Workbook_Open, else I get an error in the macro. I found the following in this forum:

    http://www.excelforum.com/excel-prog...-as-addin.html

    I have to say that I just did the same in the Workbook_Close.

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,996

    Re: Custom Categories for UDF

    For an overall solution, you might want to have a look at this article by Jan Karel Pieterse.
    For the specific question of removing the prompt, change this in the Open event:
    ThisWorkbook.IsAddin = True
    to this:
    With ThisWorkbook
       .IsAddin = True
       .Save
    End With

  7. #7
    Registered User
    Join Date
    02-10-2011
    Location
    Denmark
    MS-Off Ver
    Excel 2010 & Windows 7
    Posts
    23

    Re: Custom Categories for UDF

    Thank you for your help, this works.

    I have changed according to your suggestion in the Workbook_Open and I do not use the Workbook_Close.

    Once more thank you and have a nice weekend
    EEL1966

  8. #8
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,996

    Re: Custom Categories for UDF

    Thanks - you too.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1