View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default Adding a C# method as an Excel function

"Something simpler" for me would be to use VBA and call the the Windows APIs
that can deal with encryption, those called Crypt*.
Here's a couple of examples:
http://simplesamples.info/VB/EncryptDecrypt.php
http://www.ex-designz.net/apidetail.asp?api_id=394
You can wrap the code in a class and make to an add-in also, but all code
would be VBA.

If you need to use one of the .Net languages, then AFAIK you need something
compiled; xll, dll (ActiveX or Standard).

NickHK

"urig" wrote in message
ups.com...
Hi,

This is a newbie question - be warned :)

I need to make a method that I've written in C# available to Excel
users as a function. I have: "public string encryptSomething(string
something)" and I'd like to make it visible to Excel so users can put
"=encryptSomething(A1)" in a cell and, well, encrypt something.

I know I can do this by writing a hybrid between C# and C++ to create
an xll file. I know that's how ExcelDna (http://exceldna.typepad.com/)
does its magic. Can someone point me to a simpler example of this
technique?

And shouldn't there be a more elgant way to do this? Something that
wouldn't involve C++?

Will VSTO give me this functionality? If so, will VSTO require my end
users to install something apart from whatever DLL/XLL I will be
shipping to them?


Thanks!
urig.