How to Setup Configuration File for Excel DNA Application?

Feb 14, 2012 at 10:42 AM

Hi,

I'm trying to use Webservice with Excel DNA. As of now I'm adding the web-reference maually, but i want to configure my application on environment base so that it can pick Web Reference URL dynamically for PROD,UAT,QA.

Is there any way by which we can define config file for ExcelDNA Application and pick the values from there.

Also, What's the start point for ExcelDNA application. Is there any way by which we can define Main() function & intialize some variables.

Can we set default class or define Constructor in any class?

I know, in .dna file we can define External Library Path as below

<ExternalLibrary Path="DASHExcelAddin.dll"

But still want to know start point of an application.

 

Thanks,

Leo

Coordinator
Feb 14, 2012 at 12:40 PM

Hi Leo,

You can create a normal .config file called YourAddInName.xll.config, and place it next to you YourAddInName.xll. It will be loaded as the configuration file for the AppDomain of your add-in. You can then read settings from this configuration file using the normal .NET mechanisms.

If you have a public class that implements ExcelDna.Integration.IExcelAddIn, you'll have an AutoOpen method that is called when your add-in is loaded. This is a good place to put start-up stuff. Search for "AutoOpen" on the Google group (http://groups.google.com/group/exceldna) and I think you'll get some examples.

Regards,

Govert

Feb 15, 2012 at 6:25 AM

Hi Govert,

Thank you veru much for your assistance.

Yes, I implemented IExcelAddIn & now I'm able to get AutoOpen() method.

Regarding configurattion, I got reference from your below post & now i'm able to use configuration values in my application. http://exceldna.codeplex.com/discussions/263207

Regards,Leo