CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2009
    Posts
    4

    Smile Excel programing in C++

    Hi,

    After struggling a little bit, now I am able to write a program to access excel spreadsheets using MFC in VS2005. I am able to create the wrapper and able to access excel files, write data into it by specifying a cell number manually.

    Also I can search for data in a given range by using Range.Find() function.

    Code:
    #define vOpt COleVariant((long) DISP_E_PARAMNOTFOUND, VT_ERROR)
    ..
    ..
    Range range;
    ..
    ..
    if(range.Find(COleVariant("09/28"), vOpt, vOpt, vOpt, vOpt, (long) 1, vOpt, vOpt))
    {
    ...
    }
    Can someone please tell me how to get the cell number of that specific cell where the data is located.

    Also is there any good tutorial or help file where I can refer to for further questions.

    Thanks in advance
    -
    Gary

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Excel programing in C++

    1. No, there is not any really good documentation.
    2. The usual way is:
    • open Excel
    • record a macro with the actions you want to do
    • analyze the recorded VBA code and look for a similar functions among generated excel automation classes
    Victor Nijegorodov

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured