UDF - Not active until user logged in

Feb 7, 2012 at 9:55 AM

Hello

I have a UDF which will offload work to an RTD Server which gets data from a web service.  My problem is that I only want the UDF to be called once a user has provided login credentials to the web service.  Before then it should leave the cell's contents alone.

Is there a way to return a value from the UDF which means do nothing or do not change cell contents?  Or is there a way to make the UDF inactive initially then activate it once logon occurs and turn it off again if they logout?

Kind Regards
Jon

Coordinator
Feb 7, 2012 at 12:19 PM

Hi Jon,

Yes, you can get the old value of the cell from within your UDF.

Check this discussion on the Google group: http://groups.google.com/group/exceldna/browse_frm/thread/61416786afe5ac3f

Regards,

Govert

Feb 8, 2012 at 2:58 PM
Edited Feb 8, 2012 at 2:58 PM

Hi Govert

Thanks for the speedy response.

What about if a cell has multiple UDF calls within it that are being concatenated with a string say?  I cannot access the Google Groups link from work but will take a look from home later on.  Will the approach in the link work in that scenario?

Kind Regards
Jon

Coordinator
Feb 8, 2012 at 7:40 PM

Hi Jon,

Yes, the plan of using the old cell value won't work in that case. Maybe you can store the values in some kind of local file, and use these at runtime until the user is logged in?

The RTD server allows you to keep old values in ConnectData, but for this you need to make a permanent registration of the RTD server, either via Regsvr32 or ComServer.RegisterServer.

See this discussion: http://groups.google.com/group/exceldna/browse_frm/thread/ad6163ef47ace53d followed by this one: http://groups.google.com/group/exceldna/browse_frm/thread/4c5a71efbe96d885

This recent discussion also relates - there is a problem when running under elevated privileges: http://groups.google.com/group/exceldna/browse_frm/thread/ad6163ef47ace53d

Regards,

Govert