English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I would like to compile C++ in excel, and was told I would have to OLE link both programs. THis is all fine and dandy, but I have absolutely no idea on how to do this.

2007-07-23 16:12:37 · 3 answers · asked by eevilcheese 4 in Computers & Internet Programming & Design

Perhaps i misphrased the question...I would like to OLE link microsoft excel to compile using microsoft visual studio. There are programs that do this (calc4web) but they all cost money.

2007-07-23 16:45:19 · update #1

3 answers

Let's try again. If your plan is to use the facilities of Excel in a c++ program you write, this is very possible. If your plan is to use some c++ functions you write and call them in Excel, this is also very possible. It's just not easy to tell from your question which of these you want to do.

If you want to call c++ functions in Excel, you must create a DLL in c++ (keeping in mind that the function you want to call must have 'c' linkage--that is, no name mangling else you'll not be able to find them in Excel) with the desired functions being exportable. You can then write some vba code that calls the DLL functions.

If you want to, say, open Excel in your c++ code, fill some cells in a sheet, save the sheet, this is easy. Mind you, it's easier to do it with languages like VB or perl. But you can do it with c++. One pretty simple way is to write some VB and convert it to c++. See http://support.microsoft.com/kb/216388 for a simple way to do this. Google other terms for sample c++ code to invoke Excel via COM. BTW, Excel can act as an 'automation server' or 'COM server', which is indeed related to OLE.

2007-07-23 17:28:49 · answer #1 · answered by miket 4 · 0 0

Your request makes absolutely NO SENSE, and whoever gave you that answer was confused.

OLE is for embedding documents, like an Excel chart and an Access table into Word document. It's not for mix-and-match applications.

Why in heavens would you want to compile C++ in Excel any way?

And C++ is a language. All you'd end up embedding, even if that were possible, is the IDE (i.e. the editor), not the language / compiled program.

2007-07-23 16:22:53 · answer #2 · answered by Kasey C 7 · 0 1

Start new workbook. On sheet two input your values in contiguous cells, in a single column. Highlight the entire cells you've got simply entered values into. Use the Insert | Name | Define Menu/Options or the 'identify field' to the left of you role bar and sort in a reputation for record of values you've got simply typed in. E.g. "Mylist" Now pass to Sheet a million. If you can't see the Visual Basic Menu, proper click on at the instrument bar or use the Insert, Toolbars and in each and every case choose Visual Basic. Now in this instrument bar click on Design mode, and Toolbox. Find the Combo Box Tool, within the instrument field and click on on it. 'Draw' the mixture field onto the sheet wherein you desire it. Now, once more within the toolbox, with the Combo Box nonetheless decided on, discover and click on the Properties field. In the homes window, discover the ListFillRange estate (this looks within the left hand column) In the corresponding proper-hand column, sort within the identify of the identify of your record - "Mylist" and click on input. Now unclick Design mode, and Toolbox and in addition near the estate field through clicking at the 'x' - near window button. Now click on at the Visual Basic Editor buton at the Visual Basic oolbar. In the Project Window, double click on on Sheet a million In the left hand dropdown of the window simply opened, choose Combobox1. Complete the code so it appears like the next: Private Sub ComboBox1_Change() Range("A1").Cells.Value = ComboBox1.Text End Sub This will placed the chosen importance into Cell A1. Excel may be very strong, and there are lots of choices, homes and also you have to watch out whilst doing the matters I have defined. I am utilizing Excel 2003, and I recognise the 'gear' and different models upgrade rather as time is going through and new types are published. To do that adequately, I might get a publication on VBA with a consciousness on VBA for Excel. Anyway, desire this is helping.

2016-09-05 17:02:43 · answer #3 · answered by liskovec 4 · 0 0

fedest.com, questions and answers