> In c++ you could store an array of characters in char[20]
> and then look for a certain character in the array. but i don't know how to
> do it with VBA!
It's just Basic ... you use Mid$
You can use the following VBA function to obtain the Nth character of the
contents of an Excel cell
Function indexchar(chars As String, index As Integer) As String
indexchar = Mid$(chars, index, 1)
End Function
Then if cell A1 contains "wombat" and A2 contains 3 and A3 contains
+indexchar(A1,A2) Excel will display "m" in A3.
> if not...is it possible to tell a macro in excel to run a c++ program.
> and give what is in the workbook 1 as a txt input to c++. Then make
> the C++ program to output the result in the same workbook.
Not quite.
You can do two things: You can write a C++ program that uses OLE
Automation to run the whole Excel application under control of the C++
program, or you can write a DLL in C++ and write some VBA glue code around
the DLL so that it can be called from the spreadsheet.
However, for this simple task you don't need to do either.
Cheers,
Daniel.
Daniel James - 25 Sep 2004 14:04 GMT
> You can use the following VBA function to obtain the Nth character of the
> contents of an Excel cell
[quoted text clipped - 5 lines]
> Then if cell A1 contains "wombat" and A2 contains 3 and A3 contains
> +indexchar(A1,A2) Excel will display "m" in A3.
Rereading my own post (isn't that supposed to be a sign madness, or vanity,
or something?) I realize that in trying to answer the OP's question on its
own terms I've neglected to mention that you can do this with the built-in
Excel macro "mid" anyway
So if cell A1 contains "wombat" and A2 contains 3 and A3 contains
+mid(A1,A2,1) Excel will display "m" in A3.
Wood, trees, humbug!
Cheers,
Daniel.
maryam,
from the newsgroup I assume you are talking about managed C++. Have a look
here:
http://ManagedXLL.net/
Jens.
--
Replace MSDN with my first name when replying to my email address!
> Hi
> i have some data in excel....I want to perform a series of operations on
[quoted text clipped - 15 lines]
>
> maryam