none
Global vba Macros RRS feed

  • Question

  • I have a number of excel workbooks created by myself and others that I want to retroactively apply a single vba macro to. Do I have to create and/or copy the vba macro into each and every workbook separately or is it possible to create the macro once and apply it to the application much like we might do by altering the underlying template in MS Word?  I know that there are application macros for save (Ctrl - S), copy (Ctrl - C), cut (Ctrl - X) and others.  What I want to do is create a single macro that is activated by a Ctrl - L that can be applied globally to any excel workbook that I open.  Is this possible?

    Robert L. Collins

    Wednesday, February 24, 2016 7:59 PM

Answers

  • Hi Robert,

    If you want to capture the event of excel (e.g. open, SheetChange etc…), it is impossible to do it in the single macro, we could export VBA code to the file (e.g. bas, cls), then import to other file.

    If you just want to do something in excel (e.g. change value, format), the macro could be in a file (e.g. a excel, word, outlook etc…).

    You may consider application level add-in to achieve your requirements.

    # Getting Started Programming Application-Level Add-Ins

    https://msdn.microsoft.com/en-us/library/ms268878(v=vs.120).aspx  

    Regards

    Starain


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, February 25, 2016 6:43 AM
    Moderator