On 9/6/07, Thomas Hruska <[EMAIL PROTECTED]> wrote:
> Chandraseharan, Subramania (S.) wrote:
> > I want to read a txt file and copy that to a particular cell in excel file.
> >
> > How to do this in C?
> >
> > Is there any way?
> >
> >
> >
> > Regards
> >
> > C.Subramanian
>
> Excel exposes two different methods that will allow you to do what you
> want.  From within Excel itself, you can use a COM add-in (XLAuditor on
> my website is one such add-in).  Outside of Excel, you can use COM to
> create an Excel Application COM object (starts Excel if it isn't already
> running), open a file, modify a cell, save the file, and free the COM
> object.
>
> COM can get messy in C (and somewhat messy in C++).  And your compiler
> has to support type libraries or it'll get REALLY messy.
>
> You might want to consider using VBScript instead of C for this one.
> COM is better suited for VB-like and general scripting languages.

A simpler solution may be to convert the textfile into an intermediate
format that can be imported into Excel, like CSV, or use an ODBC
interface to Excel.

-- Brett
------------------------------------------------------------
"In the rhythm of music a secret is hidden;
    If I were to divulge it, it would overturn the world."
               -- Jelaleddin Rumi

Reply via email to