Maintaining a remote data source

Oct 1, 2010 at 9:17 PM

Our add in connects to a data source initially and uses a timer to terminate the connection if the user is inactive for a number of minutes.   Each function first checks to determine whether the connection is available and opens the connection if it is closed.

Do you have an example of how this would be done or how an application could be structured within the context of Excel Dna?

Gregg Peele


Oct 1, 2010 at 10:23 PM

Hi Gregg,

I'm not sure which part of the problem you are asking about. Is the add-in that you currently have in VBA? In that case, it should translate pretty easily to VB.NET, using the System.Timers.Timer class for the timer, and a static variable to hold the connection state.

Maybe you have a more specific question...?



Oct 1, 2010 at 10:46 PM

I think I was thinking of Excel DNA as a means to expose the c#  functions to Excel but it sounds as if not only do I expose the functions but I can have other resources shared with those functions that are static.   So I can just add the connection state code to my code referenced by the those functions.   I'm currently implemented the Addin in VB 6.0 and now I've done it as an automation add-in.   I'm looking at Excel DNA so I can build in the function level help as well and add in more functionality.

I was looking for a good sample...


Oct 2, 2010 at 8:46 AM

Hi Gregg,

It will work perfectly as you suggest. If you have any hassles converting from the Automation Add-in to one that uses Excel-Dna, let me know.