Free Microsoft Excel 2013 Quick Reference

C program in excel

Is there any way to write C program in excel ?


Post your answer or comment

comments powered by Disqus
Programming with the C API in Excel 2007

It enabled users to create custom commands and functions on special Macro sheets that look like ordinary worksheets. XLM macro sheets are still supported in Excel 2007.

Programming with the C API in Excel 2007

You can use the Microsoft Office Excel 2007 XLL Software ... What's New in the C API for Excel 2007 C API Callback Functions Excel4, Excel12

Hi there, I am using a c++ dll in excel 97 and calling dll functions, and it
works just fine. Now, When I try to run the same dll/xls file with all VBA
code, macros it gives me error right at registering the dll at line
Range("1!A1") = "=REGISTER.ID(""Black"",""ef_fv"",""BIBBBBB"") ":

Sub Auto_open()
Application.ScreenUpdating = False
Application.DisplayFullScreen = True
AddIns("Analysis Toolpak").Installed = True
Range("1!A1") = "=REGISTER.ID(""Black"",""ef_fv"",""BIBBBBB"") "
Range("1!A2") = "=REGISTER.ID(""Black"",""ef_delta"",""BIBBBBB "")"
Range("1!A3") = "=REGISTER.ID(""Black"",""ef_gamma"",""BIBBBBB "")"
Range("1!A4") = "=REGISTER.ID(""Black"",""ef_sp"",""BIBBBBB"") "
End Sub

I would really appreciate it if someone can help me in this.

I used VBA to program Excel years ago. I need to re-learn to program in
Excel. Should I brush up on VBA or learn one of the new languages?
--
SLC

I am running a business which has raw material. It is consumed at a certain rate.
I need help in making a small program in excel which answers how much raw material is available till what time, and how much is required till monday for example...................really appreciate any help
God Bless
Sajeel

So I'd like to expand my knowledge of excel and also get some exposure to programming. This is probably going to sound awful but what types of benefits does programming in excel provide. And is there somewhere I can get some beginners exposure such as readings on where to start. Thanks

Also is Visual Basic where to start or do other languages offer the same or more benefits?

Thanks

I need reference material for macro programming in Excel 2003. Examples
would also be helpful. Thank you!

Hi there, I am using a c++ dll in excel 97 and calling dll functions, and it
works just fine. Now, When I try to run the same dll/xls file with all VBA
code, macros it gives me error right at registering the dll at line
Range("1!A1") = "=REGISTER.ID(""Black"",""ef_fv"",""BIBBBBB"")":

Sub Auto_open()
Application.ScreenUpdating = False
Application.DisplayFullScreen = True
AddIns("Analysis Toolpak").Installed = True
Range("1!A1") = "=REGISTER.ID(""Black"",""ef_fv"",""BIBBBBB"")"
Range("1!A2") = "=REGISTER.ID(""Black"",""ef_delta"",""BIBBBBB"")"
Range("1!A3") = "=REGISTER.ID(""Black"",""ef_gamma"",""BIBBBBB"")"
Range("1!A4") = "=REGISTER.ID(""Black"",""ef_sp"",""BIBBBBB"")"
End Sub

I would really appreciate it if someone can help me in this.

Are there many jobs out there available for a person who is experienced in programming in Excel? I enjoy working in VBA and I'm really starting to get good at it. What companies would be looking for a person like myself? Also, I have never had formal training in programming in Excel. Can anyone suggest courses I should take, certification I should achieve, or any other route I should take?

I have an excel spreadsheet and call a C++ program from a VBA macro using
the command below. (I am not using visual C++ but a command line driven
version, Borland C++ compiler)

retval = Shell ("c:optionsoptions1.exe", vbNormalFocus)

What I want to be able to do is to pass some of the values in my excel
spreadhseet to the C++ program when calling it. There are 5
variables(spreadsheet cells) whose numerical values I want to pass across to
the program.

Once the C++ program has run I want to put a value that it caluculates in to
a cell in my excel spreadsheet.

Any help much appreciated please.

Many thanks

Hello,

I have written a function in C that calculates a double through an
iterative process (I found VBA too slow for it).

By adding the declaration to my function in VBA, the function becomes
available as a User Defined Function :

Public Declare Function afschrijving _
Lib "C:Program FilesMicrosoft OfficeOfficeair.dll" _
Alias "_afschrijving@52" _
(ByVal aankoopwaarde As Double, _
ByVal levensduur As Long, _
...
) as Double

Is this possible by just moving the dll in the right directory and
registering the function somewhere somehow when Excel starts ? The
calculation is still slow, even when I simplify the function to an
addition of 2 variables. I suspect that by going through VBA and a
User Defined Function, it slows down the calculation.

When my function makes a division by zero, I would like to communicate
an error to Excel (now I return zero as answer, which is wrong, I want
to have #DIV/0 in my worksheet).
I can put the answer in an XLOPER-structure. When there is no answer
but an error-message, I can put it in the XLOPER-structure as well.
But how do I declare such a function in VBA ?

Public Declare Function afschrijving _
Lib "C:Program FilesMicrosoft OfficeOfficeair.dll" _
Alias "_afschrijving@52" _
(ByVal aankoopwaarde As Double, _
ByVal levensduur As Long, _
... , _
ByRef answer As XLOPER _
) as Long

The Long that is returned becomes useless, the answer is now in the
XLOPER-structure (though I don't believe that this works : how do I
create a reference to an XLOPER-structure in VBA), but how do I declare
a function 'VOID' in VBA ?

A lot of questions, is there someone who can point me to a book or a
webpage that explains these things ?

With kind regards
Joris Adriaenssens

I have an excel spreadsheet and call a C++ program from a VBA macro using
the command below. (I am not using visual C++ but a command line driven
version, Borland C++ compiler)

retval = Shell ("c:optionsoptions1.exe", vbNormalFocus)

What I want to be able to do is to pass some of the values in my excel
spreadhseet to the C++ program when calling it. There are 5
variables(spreadsheet cells) whose numerical values I want to pass across to
the program.

Once the C++ program has run I want to put a value that it caluculates in to
a cell in my excel spreadsheet.

Any help much appreciated please.

Many thanks

I have a C++ program that generates a table of data in real-time, and it updates constantly. I want to be able access the data that it generates with a separate program in Excel/VBA. The problem, of course, is that I can't just write the file and have Excel show me the live data collection because the file is already open. So what do I do?

Is there a way to synchronize the data? What do I need to do to command Excel to generate a table that I can view and edit in Excel while it's being updated by my C program? Can I get Excel to allow me to have the file open in more than one place? Read-only doesn't work because it doesn't keep the file updated...

You guys are the experts, any suggestions?

I'm interested in writing some C++ functions that can be access in Excel 97. I've been doing some research on this topic, but would love any advice, recommendations of resources (books, forums, etc.).

I have advanced beginner/intermediate knowledge of C++, VB, VBA and Excel 97.

THANKS MUCH!

I found the following article related to this issue but this does not seem to
work in Excel 2003.
http://support.microsoft.com/default...b;en-us;810789

Is there another method to define custom locations for Add-in Programs?

I'd like to get a recommended source of info (books,CD's, etc.) where I can
learn how to program macros in Excel. I know the embedded recording method,
but I need to program spcial activities i.e. in a given table, move the
cursor until a certain value is found and if so delete the row. Basically, I
need to know the language syntax, the method of inserting and saving the
macro, its availability for other spreadsheets, etc.
Thanks
--
CarlosD_LongIsland

Hello,

I'm new to programming in Excel and I'm trying to learn how to write VB in
Excel and then run the macro. I'm using Excel 2003 and I'm trying to start
with something simple. Here is what I'm trying but I think there is a syntex
error:

I'm trying to change the color background for cell G4 based on the value of
cell F4. If G4 is less than F4, I want the background of G4 to change to Red
indicating this cell is not completed. If it is = to F4, I want G4
background to change to Green indicating it is completed.

Here is my code:

If (F4 < G4) Then G4.Background = vbRed
Else: G4.Background = vbGreen
End If

Thanks in advance from your help.

Hi,

Can anyone please help me?

I am writing a simple totalize program in Excell. Each month i will add
data to various columns. Each month these figures will change the positions
of each column. For example: the first moth column A may be 36, column B may
be 24 and column C may be 19; this will give a rank structure A = First, B =
Second and C= Third. The following month these numbers will increase because
of new data that will be added, however with this new data, Column A may now
be Second, C maybe first and B remain second. What I require is Function,
Marco “what ever it’s called”! that will be able to analyse the 3 figures and
in a cell below the figure insert the corresponding rank position, ie, First,
Second & Third and update them automatically each time new data is added and
the positions change.

Thank you

Ian Parry

I wrote a program in Excel 2010 and it works fine, but this code will not work in 2003. I did check the object references in vba and unchecked the Missing ones, which was Outlook. I am getting errors such as "Can't find project or Library" and Mismatch type among others. It all seems to circle around the 2 lines of code that I highlighted below in red.


Application.Calculation = xlCalculationManual
Application.ScreenUpdating = False

Sheets("Standard Output").Select
x = 0
Range("A18:A10000").ClearContents

For Each C In Range("SUB_OPS_USED")

    If C.Value = "YES" Then
        UsedSubOp = C.Offset(0, -2).Value
        Range("SubOpListingStart").Offset(x, 0).Value = UsedSubOp
        x = x + 1
    
    End If
    
Next C

Range("A18:A10000").Select
ActiveWorkbook.Worksheets("Standard Output").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Standard Output").Sort.SortFields.Add Key:=Range( _
        "A18"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
        xlSortNormal
    
With ActiveWorkbook.Worksheets("Standard Output").Sort
        .SetRange Range("A18:A10000")
        .Header = xlNo
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
End With

Range("A1").Select

End Sub


Hi,
Please, can anyone help me with the shortcomings mentioned here about a "page-break" instruction in a Words document in a code when running in Excel.

In addition, the normal code in Words for MoveUp" does not work, I want to get up into an imported table with data and adjust the characteristics of the table in order to fit the page in Words.

Thanks in advance for kind assistance
/ bjorn

This is my very first attempt to seek advice in programming VBA.
Background: XP professional, Office 2000

The context & the problem :

Running a long program in Excel with many macros / coded subs in background.
The program will result in a lot of reports, typically of 5-25 pages each & with a lot of conditional text created in excel macros / VBA
I want (must) get print out in Words as such printout is smoother.
Everything is - be the end of a lot of work - OK, except to make a page-break in the excel routine that runs what to be done in the created word document.
Some instructions are OK, for example to rearrange margins, others, for example pagehead and pagefoot does not work, but WORST:
In words, the "instruction" for page break is - .InsertBreak Type:=wdPageBreak - to be put within With wrd (= stands for Words..) and With .selection.
In words, it works, but when running from Excel, it does NOT work.

The code under Excel used for this small program sequence is found below
' Open a document
Set wrd = GetObject(, "Word.Application"):

With wrd:
With .Selection
.TypeParagraph
.TypeParagraph
.TypeText Text:="This is page 1"
.TypeParagraph

.TypeParagraph
'.Collapse Direction:=wdCollapseEnd
'.InsertBreak Type:=wdPageBreak ' tried - did not work

'.InsertBreak Type:=wdSectionBreakContinuous, ' tried - did not work
.TypeParagraph
.TypeParagraph
.TypeText Text:="Some text on page 2"
.TypeParagraph
.Sections.Add ' this works, but text instructions after this command IS NOT placed after a page break
' .MoveEndUntil Cset:="a ", Count:=wdForward, tried.... did not work
' .MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
.TypeText Text:="Here should be text, for example to state that we are now on page 2..."
End With
End With
Stop

Is it possible to have some help on this (trivial ??) matter ?
Regards Bjorn

Hello Everyone,

I`m stuck creating a small program in Excell 2007.

What I need is a dropdownbox or -list with content. The content is on another spreadsheet in the same document. I have found the dropdownbox, but unfortunately I cannot put this content into the dropdown box.

Looking around on the web, I have found that I am missing an option. Normally when selecting the dropdownbox there is an option where you can input a range of cells.

It is not there, can anyone help me?

I have written a program in Excel 2003, that
has some Visual Basic.
When someone trys to open it in Excel 2007,
the program will not open, but instead a
dialogue box suddenly appears, which says :-

Unprotect sheet
Password :- ?

What do I need to do, to the Visual basic to
ensure that this dialogue box does not appear,
so that the program will open just the same
in Excel 2007 ?

Is it possible to rename the alphabetical headings (A, B, C, D...) in Excel?

Hi,

I need to send and potentially receive data from a given IP address and
port. Any idea on where I can find ideas/sample code on how to do this
in Excel VBA?


No luck finding an answer? You could always try Google.