With add-in loader, it is possible to define .dotm files which will be loaded when Word open. This is a function equal to the STARTUP folder, but beneficial as we only work inside the alloy structure.
In order to define these .dotm or add-ins, the plugin named SkabelonDesign.AddinLoader must be copied into the clients SDUP. As well as a very specific content structure with adhering json configuration:
The folder is located in SD installers:
SD.Installers\Z_AlloyPlugins\Configuration\SkabelonDesign.AddinLoader
Copy the folder contents into:
...OfficeExtensions\Content\SkabelonDesign.AddinLoader
Within the folder SkabelonDesign.AddinLoader, you will see a file named:
settings.json
Within the settings.json general VBA settings are defined. In the file it is possible to activate or deactivate the following:
{
"VbaSettings": {
"LoadVba": true,
"RespectAutomationSecurity": false,
"LoadDirectlyFromMaster": true
},
"VbaAddins": [
{
"MasterPath": "%content%\\Druckfunktion.docm",
"SlavePath": "%appdata%\\OfficeExtensions\\AddinLoader\\Druckfunktion.docm"
}
]
}
- LoadVba: Whether or not the .dotm should be loaded, this must be true to tell Word to load the file.
- RespectAutomationSecurity: With AddinLoader we actually sneak behind the security layer in Word, and can load an add-in from an untrusted location. If this is set to true, we respect the security settings in office, if set to false we bypass it.
- LoadDirectlyFromMaster: Whether or not the .dotm should be loaded from the MasterPath or the SlavePath.
The Masterpath refer to the primary location AddinLoader will load the add-ins from, typically programdata. The SlavePath is beneficial as it is a copy of the MasterPath, and the user will not experience to be interrupted as the add-ins will load from the SlavePath if the Masterpath is locked, typically pointed to the users appdata.
Add the macro document next to the settings file in Content.
Loading additional add-ins
In order to load additional add-ins, just add one or more .dotm files in the folder, and add a new settings_NameAddon.json to define settings for each .dotm file. Only one settings.json is needed in the folder.
The name of the file is optional, but must end with .json and be structured as follows in the settings_NameAddon.json:
{
"VbaAddins": [
{
"MasterPath": "%content%\\test2.dotm",
"SlavePath": "%appdata%\\OfficeExtensions\\AddinLoader\\test2.dotm"
}
]
}
Notice the \\ as a notation standard in .json format. Use this tool to easily ensure correct json structure.
Comments
0 comments
Article is closed for comments.