Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Reading Excel files in VC

Reading Excel files in VC

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
7 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kk tvm
    wrote on last edited by
    #1

    How to read excel files in VC thanx by KK

    D C R B 4 Replies Last reply
    0
    • K kk tvm

      How to read excel files in VC thanx by KK

      D Offline
      D Offline
      Dreamz
      wrote on last edited by
      #2

      Check this[^]....

      K 1 Reply Last reply
      0
      • D Dreamz

        Check this[^]....

        K Offline
        K Offline
        kk tvm
        wrote on last edited by
        #3

        thanx for solution Any other solution (not using Database) for reading Excel file by KK

        D 1 Reply Last reply
        0
        • K kk tvm

          thanx for solution Any other solution (not using Database) for reading Excel file by KK

          D Offline
          D Offline
          Dreamz
          wrote on last edited by
          #4

          I don't know KK... This was one article i came across, when i was searching for somethins... We'll wait for somebody else' reply.... Good luck....

          1 Reply Last reply
          0
          • K kk tvm

            How to read excel files in VC thanx by KK

            C Offline
            C Offline
            Cedric Moonen
            wrote on last edited by
            #5

            You can use Excel automation also. Make a search on google (or this website)

            1 Reply Last reply
            0
            • K kk tvm

              How to read excel files in VC thanx by KK

              R Offline
              R Offline
              Roger Allen
              wrote on last edited by
              #6

              You can find info on many file formats here inclusing Excel. http://www.wotsit.org/[^] If you vote me down, my score will only get lower

              1 Reply Last reply
              0
              • K kk tvm

                How to read excel files in VC thanx by KK

                B Offline
                B Offline
                Barm
                wrote on last edited by
                #7

                use Excel automation CApplication app; CRange range; CWorkbook book; CWorkbooks books; CWorksheet sheet; CWorksheets sheets; VARIANT ret; COleVariant covTrue((short)TRUE),covFalse((short)FALSE),covOptional((long)DISP_E_PARAMNOTFOUND,VT_ERROR); try { CoInitialize(NULL); if(!app.CreateDispatch("Excel.Application")) { AfxMessageBox("Cannot start Excel"); return; } books = app.get_Workbooks(); book = books.Open(fname,covOptional,covOptional,covOptional,covOptional ,covOptional,covOptional,covOptional,covOptional ,covOptional,covOptional,covOptional,covOptional ,covOptional,covOptional); // different for different ver of Excel // check msdn website sheets = book.get_Worksheets(); sheet = sheets.get_Item(COleVariant((short)1)); sprintf(cell,"%c%d",alpha[k],j); // eg A1, A2, etc range = sheet.get_Range(COleVariant(cell),COleVariant(cell)); ret = range.get_Value2(); CString t = ret.bstrVal; // t will hold the value of the cell books.Close(); app.Quit(); // close excel application remember to close application } catch(COleException *e) { char buf[1024]; sprintf(buf, "COleException %081x.", (long)e->m_sc); } catch(COleDispatchException *e) { char buf[1024]; sprintf(buf, "COleDispatchException %081x.", (long)e->m_wCode); } catch(...) { char buf[1024]; sprintf(buf, "General Exception"); } hope tis helps Thomas

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups