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. Excel automation highlight issue

Excel automation highlight issue

Scheduled Pinned Locked Moved COM
helpcomtestingtoolstutorial
3 Posts 2 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.
  • T Offline
    T Offline
    TClarke
    wrote on last edited by
    #1

    Hi all, I'm automating Excel from within an ActiveX control and I'm wondering if anyone knows how to highlight the contents of a cell. I'm writing a specialised search routine and I have no problem finding the cells I want but when I select them only the perimeter of the cell gets highlighted. I'm after being able to highlight the contents but haven't found what I need in the type library. Recording a macro didn't throw any light on the issue either. Thanks in advance for any ideas.

    Cheers Tom Philosophy: The art of never getting beyond the concept of life. Religion: Morality taking credit for the work of luck.

    G 1 Reply Last reply
    0
    • T TClarke

      Hi all, I'm automating Excel from within an ActiveX control and I'm wondering if anyone knows how to highlight the contents of a cell. I'm writing a specialised search routine and I have no problem finding the cells I want but when I select them only the perimeter of the cell gets highlighted. I'm after being able to highlight the contents but haven't found what I need in the type library. Recording a macro didn't throw any light on the issue either. Thanks in advance for any ideas.

      Cheers Tom Philosophy: The art of never getting beyond the concept of life. Religion: Morality taking credit for the work of luck.

      G Offline
      G Offline
      Garth J Lancaster
      wrote on last edited by
      #2

      there's some code following from a MS MFC example : Look at excelApp.GetRange(COleVariant("A1"),COleVariant("C6")).Select(); does that help ? 'g' #include "excel8.h" // ... OleVariant covTrue((short)TRUE), covFalse((short)FALSE), covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR); _Application excelApp; if(!excelApp.CreateDispatch("Excel.Application")) { // error handling } excelApp.GetWorkbooks().Add(covOptional); excelApp.GetRange(COleVariant("A1"),COleVariant("C6")).Select(); excelApp.GetActiveCell().SetFormula("Hello World!"); excelApp.SetVisible(TRUE);

      T 1 Reply Last reply
      0
      • G Garth J Lancaster

        there's some code following from a MS MFC example : Look at excelApp.GetRange(COleVariant("A1"),COleVariant("C6")).Select(); does that help ? 'g' #include "excel8.h" // ... OleVariant covTrue((short)TRUE), covFalse((short)FALSE), covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR); _Application excelApp; if(!excelApp.CreateDispatch("Excel.Application")) { // error handling } excelApp.GetWorkbooks().Add(covOptional); excelApp.GetRange(COleVariant("A1"),COleVariant("C6")).Select(); excelApp.GetActiveCell().SetFormula("Hello World!"); excelApp.SetVisible(TRUE);

        T Offline
        T Offline
        TClarke
        wrote on last edited by
        #3

        Thanks for the response. Adding text as you have done seems to change it somewhat. Unfortunately, I'm dealing with read only files and as such I'm only trying to highlight what's already present. The call to Select() doesn't highlight the content, only the outline of the cell :( Thanks though

        Cheers Tom Philosophy: The art of never getting beyond the concept of life. Religion: Morality taking credit for the work of luck.

        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