Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is an Excel Add-In saved when programmatically adding and installing it?

Im trying to automate adding & installing an Add-In for Excel where the Add-In is located on a shared network drive. I know from my reading around the web (here and here) that I need to make the copy that's on the shared network drive Read-Only. And thanks to the first link I now know how I can go about making revisions, fixes, and additions to my Add-In down the road using this method of keeping the file on the shared network drive.

Now having an idea of the process, I started looking into how to automate the adding and installing of the Add-In once it's on the shared network drive. I came across this post, which pointed me in the right direction of using the Excel.AddIn object. So, I was spending some time looking at the msdn documentation on the AddIn Object properties (Installed Property and AddIn Object itself), which is where I found this bit of code that adds and installs the Add-In in one line

AddIns.Add("generic.xll").Installed = True

My question (and concern):

In the instructions below

Instructions

Bullet point five has me slightly concerned because I have not been able to find out through my digging around the web if using the above code snippet to add and install the Add-In will copy it to the local/user's folder (which I don't want), keep it in the shared network folder, or if it will prompt the user just like when they manually browse to add the Add-In. If it prompts them is there any way to choose for them (to always click 'No') or is there a way to choose 'No' without showing them the prompt at all? How can I use the above code and make sure that it's adding and installing the Add-In file that's on that shared network drive? Can anyone shed some light on this situation for me?

like image 952
CaffeinatedMike Avatar asked Sep 26 '22 07:09

CaffeinatedMike


1 Answers

Great question. What you are looking for is the CopyFile argument of the Addins.Add method. Setting it to false is the same as replying "No" to the "Copy to Local Folder?" prompt:

enter image description here

And just to clarify what you already know the Addin.Installed property just determines whether the addin is selected in the Addins dialog. (Not tremendously clear to me when I first encountered it).

like image 183
Doug Glancy Avatar answered Dec 31 '22 21:12

Doug Glancy