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. COM
  4. IDispatch

IDispatch

Scheduled Pinned Locked Moved COM
16 Posts 3 Posters 8 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.
  • T trioum

    I got the event of sheet change but still not getting the value of cell and its location i.e. row and col of cell in the function . STDMETHODIMP CAppEventListener::HandleSheetChange( IDispatch* xlSheet, IDispatch* xlRange) { OutputDebugString("HandleSheetChange\n"); HRESULT hr = S_OK; return hr; }

    Trioum

    C Offline
    C Offline
    Cool_Dev
    wrote on last edited by
    #7

    did u examine the xlRange value? I think it will contain the cell range where the event is fired. Try calling get_Text() on this range to get text in the cell.. see various methods on Range object.. :thumbsup:

    T 1 Reply Last reply
    0
    • C Cool_Dev

      did u examine the xlRange value? I think it will contain the cell range where the event is fired. Try calling get_Text() on this range to get text in the cell.. see various methods on Range object.. :thumbsup:

      T Offline
      T Offline
      trioum
      wrote on last edited by
      #8

      but i am not getting the get_text() method . in this function .

      Trioum

      C 1 Reply Last reply
      0
      • T trioum

        but i am not getting the get_text() method . in this function .

        Trioum

        C Offline
        C Offline
        Cool_Dev
        wrote on last edited by
        #9

        how did u try it? please show a bit of code..

        T 1 Reply Last reply
        0
        • C Cool_Dev

          how did u try it? please show a bit of code..

          T Offline
          T Offline
          trioum
          wrote on last edited by
          #10

          STDMETHODIMP CAppEventListener::HandleSheetChange( IDispatch* xlSheet, IDispatch* xlRange) { OutputDebugString("HandleSheetChange\n"); xlRange-> here not gettting text method HRESULT hr = S_OK; return hr; }

          Trioum

          C 1 Reply Last reply
          0
          • T trioum

            STDMETHODIMP CAppEventListener::HandleSheetChange( IDispatch* xlSheet, IDispatch* xlRange) { OutputDebugString("HandleSheetChange\n"); xlRange-> here not gettting text method HRESULT hr = S_OK; return hr; }

            Trioum

            C Offline
            C Offline
            Cool_Dev
            wrote on last edited by
            #11

            oh.. You did exactly as i guessed :doh: . xlRange is Range object's IDispatch iterface. If you haven't already done, add a Range class (say CRange) to the project from EXCEL.exe using 'Add MFC Class from Typelib' wizard. Then CRange oRange(xlRange); See the methods on Range object now by using oRange. ---- :)

            T 1 Reply Last reply
            0
            • C Cool_Dev

              oh.. You did exactly as i guessed :doh: . xlRange is Range object's IDispatch iterface. If you haven't already done, add a Range class (say CRange) to the project from EXCEL.exe using 'Add MFC Class from Typelib' wizard. Then CRange oRange(xlRange); See the methods on Range object now by using oRange. ---- :)

              T Offline
              T Offline
              trioum
              wrote on last edited by
              #12

              Done it . but exe is crashing as I call getText()

              Trioum

              T 1 Reply Last reply
              0
              • T trioum

                Done it . but exe is crashing as I call getText()

                Trioum

                T Offline
                T Offline
                trioum
                wrote on last edited by
                #13

                Now by lot of R&D problem is solved . Can you guide me for SheetCalculate event . its example is not given on the site.

                Trioum

                C 1 Reply Last reply
                0
                • T trioum

                  Now by lot of R&D problem is solved . Can you guide me for SheetCalculate event . its example is not given on the site.

                  Trioum

                  C Offline
                  C Offline
                  Cool_Dev
                  wrote on last edited by
                  #14

                  well done :thumbsup: OLE automation may need some R&D most time. You can catch SheetCalculate event in much the same way you did for SheetChange event. Mean, all reside in IAppEvent interface, so Advice() for it, and override the SheetCaluclate method. HRESULT _stdcall SheetCalculate(IDispatch* pSheetDisp) { //let CWorkSheet is the wrapper of _WorkSheet CWorkSheet oSheet(pSeetDisp); //do whatever you want to do here.. :) }

                  T 1 Reply Last reply
                  0
                  • C Cool_Dev

                    well done :thumbsup: OLE automation may need some R&D most time. You can catch SheetCalculate event in much the same way you did for SheetChange event. Mean, all reside in IAppEvent interface, so Advice() for it, and override the SheetCaluclate method. HRESULT _stdcall SheetCalculate(IDispatch* pSheetDisp) { //let CWorkSheet is the wrapper of _WorkSheet CWorkSheet oSheet(pSeetDisp); //do whatever you want to do here.. :) }

                    T Offline
                    T Offline
                    trioum
                    wrote on last edited by
                    #15

                    I got it and do it , but facing one more problem as in case on "change event" I got the cell number i.e its row and column in which value is change . But "calculate event" fire when there is reference of another cell or cell containing formulae and when value change in such cell in this case I am not getting the cell no i.e cell row and column . this is my problem it become very tedious when I have the thousand of such cells having reference of various cells and formulaes. In this case I have to parse every cell to find out the value change . this become very slow for my project .I am searching the way to find out the cell row and column when there is calculate event fire .

                    Trioum

                    T 1 Reply Last reply
                    0
                    • T trioum

                      I got it and do it , but facing one more problem as in case on "change event" I got the cell number i.e its row and column in which value is change . But "calculate event" fire when there is reference of another cell or cell containing formulae and when value change in such cell in this case I am not getting the cell no i.e cell row and column . this is my problem it become very tedious when I have the thousand of such cells having reference of various cells and formulaes. In this case I have to parse every cell to find out the value change . this become very slow for my project .I am searching the way to find out the cell row and column when there is calculate event fire .

                      Trioum

                      T Offline
                      T Offline
                      trioum
                      wrote on last edited by
                      #16

                      Now I am facing one more problem . I have multiple excel file runnig on one system , but I am getting only one excel file using GetActiveObject. when I close this then I am getting second one using get object . so why I am not getting all the excel files ??

                      Trioum

                      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