Paste it into the code:
Private Sub Workbook_Open() 'Вместо EntryPoint вставьте название Вашего главного метода' Call EntryPoint End Sub
True, this will not work if the user has macro lock enabled in the settings (this is enabled by default). We still need to help him disable this option. In fact, a more interesting question is how to do it by a simple program method. I can not imagine. Probably through the registry or maybe there is some built-in VBA function for this.
Code for autoload when opening Word:
Private Sub Document_Open() 'Вместо EntryPoint вставьте название Вашего главного метода' Call EntryPoint End Sub
I will add to the answer igumnov .
The code must be inserted into the EtaBook module (For Word - ThisDocument )
Alt + F11 - open the VBA project. On the left is the project window, the module is located there in the Microsoft Excel Objects folder .
The executable macro is written to the common module (in the Modules folder).
If there is no module, you need to create it: in the VBA editor, the Insert-Module tab
If there is no project window, open - menu Viev-Project Explorer (Ctrl + R)
If macros are disabled, no internal security can change the security level. There is no such command in VBA either. This would contradict the logic of protection: we prohibit macros, but by the same macro we allow them.
Change security level manually:
For Excel 2003 : Service-Macro-Security menu
For Excel 2010 deeper: the ribbon tab File-Parameters-Center_Management_Security-Parameters_Center_Control_Security_Management-Parameters
You can programmatically change the security level, but before that you need to install a script on your computer that can change the security level. Such programs are freely available.