You just created your super-secret macros following one of the suggested ways, but, how can you call them from other macros? More importantly, what will happen if the hidden macros are in one module and the caller macros are in a different one? In that case, you can follow one of the solutions below: Add a dummy, optional parameter in the macro/sub declaration.Make the entire module Private (Option Private Module).Declare the macro/sub using the Private keyword.So, assuming that you want to make your macros “invisible”, how are going to do that? Well, there are three ways: The procedure that was just described is technically a variation of encapsulation, as it is commonly known in object-oriented programming. within a sequence of macros, an intermediate macro is only useful when it is called in the right order), or they might even break things if they are accidentally called (e.g. In that case, you may want to hide the macros of intermediate steps from the user’s eyes since either are useless on their own (e.g. an extensive calculation broken into 5 macros). A typical example of this is when you have a long procedure that is consisted of many intermediate steps and each step is a separate macro (e.g. A common practice of many VBA developers is to restrict access in the code that they don’t want the users to “see” in the Macros menu of Excel (i.e.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |