Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

C / Excel interface in Windows

Status
Not open for further replies.

reymundo

Technical User
Jul 29, 2008
2
0
0
US
Hi,
Is it possible to write a C application that can
extract/insert/manipulate data in an Excel worksheet,
and that application can run on other Windows
systems without having to load any special libraries or
dll's onto those systems? Maybe run on most any PC with
Windows 2000 or higher with Excel 2000 or higher. If yes,
would anyone have a -simple- example?
 
You can do it in Javascript which is the closest language to C that I can think of. Does it have to be a C application or can it just be a .wsf or .js script file.

You will need Excel to be preinstalled on the system.
 
Why not just write an Excel macro in Visual Basic for Applications (VBA)? Does the application have to exist external from Excel? As xwb points out, you'll have to have Excel anyway.
 
Thanks for the reply's. As stated in the original question,
the target systems would be Windows with Excel installed
on them. Yes, i'd much prefer the application to be in C/C++
 
I'm not a database programming expert, but if you have full-blown Visual Studio with MFC, you can use CDatabase and CRecordset classes to create objects to read and write to an ODBC data source based on an Excel spreadsheet. At least, I recall doing this once upon a time. As for examples, I have none to offer, but the MSDN library should give some guidance. I don't think there is such a thing as a simple ODBC example anyway. Hope this helps a bit...
 
Yes, Excel incorporates a feature called the C-API. As a matter of fact, MS expanded/updated the C-API in Excel 2007, which prior to that hadn't been changed much since the original release in Excel 97. A good reference source is a book named "Financial Applications Using Excel Add-in Development in C/C++" by Steve Dalton, John Wiley & Sons, Ltd. publisher. He has many examples on the accompanying CD.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top