473,698 Members | 2,220 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

calling C# functions from excel

Basically, I have two questions:

1. How do you create an .xll file using C# and Visual Studio .NET?

2. How do you make functions callable/visible from Excel (2000 or XP)?

I am very new to this type of programming, so I apologize if this is very
elementary or obvious. Most of my previous experience is mostly in Fortran,
various assembly codes, and some C.

Thanks.
Nov 15 '05 #1
3 7388
Xll or xls?
If Excel file then you can read and write to Excel files using ADO.net

"Mark Schaffer" <ms*******@spam cop.net> wrote in message
news:O3******** ******@TK2MSFTN GP10.phx.gbl...
Basically, I have two questions:

1. How do you create an .xll file using C# and Visual Studio .NET?

2. How do you make functions callable/visible from Excel (2000 or XP)?

I am very new to this type of programming, so I apologize if this is very
elementary or obvious. Most of my previous experience is mostly in Fortran, various assembly codes, and some C.

Thanks.

Nov 15 '05 #2
Mark,

You can not create an .xll file using C#, as far as I know.

If you want to make calls to .NET objects from within Excel, then you
will want to look into COM interop, which will allow you create COM objects
which you can use from any language that supports COM (including VBA in
Excel). Check out the section of the .NET framework documentation titled
"COM Interoperabilit y in Visual Basic and Visual C#", located at (watch for
line wrap):

http://msdn.microsoft.com/library/de...sicvisualc.asp

Also, you can look into creating a COM Add-in for Excel, which can be
loaded in Excel to provide services to everyone using Excel.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni************* *@exisconsultin g.com

"Mark Schaffer" <ms*******@spam cop.net> wrote in message
news:O3******** ******@TK2MSFTN GP10.phx.gbl...
Basically, I have two questions:

1. How do you create an .xll file using C# and Visual Studio .NET?

2. How do you make functions callable/visible from Excel (2000 or XP)?

I am very new to this type of programming, so I apologize if this is very
elementary or obvious. Most of my previous experience is mostly in Fortran, various assembly codes, and some C.

Thanks.

Nov 15 '05 #3
To create Xscel file from C# you will have to create a reference to the
Excel COM obect within your C# project, after which you can use it at will.
Make sure you have the documentation installed!

To reverse the situation and call managed code from excel you will have to
use COM Interop to create a COM component out of your assembly.

"Mark Schaffer" <ms*******@spam cop.net> wrote in message
news:O3******** ******@TK2MSFTN GP10.phx.gbl...
Basically, I have two questions:

1. How do you create an .xll file using C# and Visual Studio .NET?

2. How do you make functions callable/visible from Excel (2000 or XP)?

I am very new to this type of programming, so I apologize if this is very
elementary or obvious. Most of my previous experience is mostly in Fortran, various assembly codes, and some C.

Thanks.

Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3434
by: info | last post by:
After using clipboard functions in Excel controlled from Access VBA, Excel doesn't quit when I use the following ExcelApp.Quit Set ExcelApp = Nothing If I don't use the clipboard functions in my Access code, Excel is terminated properly. I have seen discussions on this subject by can't find the answer to my
1
3066
by: | last post by:
Hi all, I have some statictcle functions in C#, I am making some Excel templates, they are xls files. How to make my template using these functions? Before these functions are in Excel VB so I used them in my Excel template like this: =FileName!FunctionName()
0
956
by: Excel calling web services | last post by:
I need a Yes/No answer on whether or not if Excel can retrieve dataset from web services. i download office web service toolkit and create two functions in web services for Excel, one returns "String", another return "Dataset", string works fine but Dataset gives error message. Not sure if Excel supports dataset at this time. Thanks,
1
2604
by: Dartish | last post by:
Hi all, Thanks in advance for the help I have a DLL that which has several functions that I can call in Excel. I am thinking of how to call these functions in a .net project (authored in C#). I guess I need to describe how I used the DLL in Excel to motive this discussion
4
5491
by: Grumpy Aero Guy | last post by:
Is it possible to call functions wrapped in a DLL created via VS 2003 (Academic) from within an Excel 2003 Module via VBA (Declare Statement in Excel VBA)? I know this works with DLLs wrapped with VB6.0P. I have looked on MSDN, but have no clue where to start searching. -- Grumpy Aero Guy
9
4185
by: Torben Laursen | last post by:
Hi I have a class that I use in Excel to define some custom functions. The problem that I have is that the class also has some building functions that for some reason is there: ToString GetType GetHashCode Equals
0
18783
NeoPa
by: NeoPa | last post by:
Many of us have noticed that there are some very useful functions available to you when using Excel, but these same functions are not available, as standard, in Access. A particular issue I had recently (and I know others have come across this recently too) is rounding up and down. I know the Excel ROUNDUP() function rounds away from zero rather than upwards specifically, but is still useful in most circumstances. To allow an Access...
5
15127
ADezii
by: ADezii | last post by:
Periodically, the same or similar question appears in our Access Forum: How can I use Excel Functions within Access? For this reason, I decided to make this Subject TheScripts Tip of the Week. In order to demonstrate the use of Excel Functions within the context of Access, I performed the following steps in sequence: Created a Public Function called fStripNonPrintableCharacters() which will encapsulate the logic for executing the Excel...
3
2837
by: keirnus | last post by:
Hello once again... I made a function in Excel. The function does some error checking within the Excel file. To be easy for me, I want my code in MS Access to simply call the function in Excel. I check this MS Support site: http://support.microsoft.com/kb/198571 I tried calling my function and it didn't work. Here's my MS Access code:
0
9164
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9029
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8870
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7734
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6524
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3051
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2332
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2006
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.