473,385 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 7367
Xll or xls?
If Excel file then you can read and write to Excel files using ADO.net

"Mark Schaffer" <ms*******@spamcop.net> wrote in message
news:O3**************@TK2MSFTNGP10.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 Interoperability 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**************@exisconsulting.com

"Mark Schaffer" <ms*******@spamcop.net> wrote in message
news:O3**************@TK2MSFTNGP10.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*******@spamcop.net> wrote in message
news:O3**************@TK2MSFTNGP10.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
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...
1
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...
0
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...
1
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#)....
4
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...
9
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...
0
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...
5
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...
3
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....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.