At the institute, in production practice they were given the task - to write a kind of installer with options for importing and exporting macros to Excel. Made the implementation through the import of macros in the Personal Macro book:

var App = new Excel.Application { Visible = false }; var PersonalWorkBook = App.Workbooks.Open($"{System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData)}\\Microsoft\\Excel\\XLSTART\\PERSONAL.XLSB"); PersonalWorkBook.VBProject.VBComponents.Import(FileName); PersonalWorkBook.Save(); App.Quit(); 

But this option was not passed in the company, because of the security policies, appeals to the Personal Book are suppressed. Now I am at an impasse, I do not know how else this can be realized. In general, the program can be described as follows:

  1. Macros are added to the program, a description of them is entered, a certain macro library is obtained.
  2. An employee of the IT department comes with this program to the user, selects the macros he needs and imports them to him in a couple of clicks.

Example of the program:

An example of the design of the program

  • can simply save macros in the program as text, if you select a macro in the program, copy this text to the clipboard, and then add this text somewhere to the user ... where your policies allow, you can perhaps use these macros as add-ons for Excel ... - SergeyE
  • Но этот вариант не прошел на фирме, из-за политик безопасности обращения к Персональной книге пресекаются. Did you check it with IT rights? - sp7
  • Develop and save macros in a separate book / books. These books are saved as add-ons and add to users the right ones. You do not need to program anything, this is a standard excel function. However, you need to remember that such macros will be available to the user in any excel file. If it suits, there is no problem. - rdorn
  • @ sp7 yes, the Personal Macro Book is read only ... - Ivan Kostyashov
  • @rdorn is the problem that macros are already developed. We need to structure them into one library and optimize the installation process. - Ivan Kostyashov

0