Results 1 to 9 of 9
  1. #1
    New Lounger
    Join Date
    Oct 2007
    Location
    Copenhagen, Denmark
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to obtain cell-edit mode? (Excel2003 SP2)

    Hi all!

    In build 11.8146.8132 of Excel 2003 with SP2 this method wil NOT tell me if or if not user are in cell-edit mode!

    Private Function IsExcelInEditMode() As Boolean
    IsExcelInEditMode = (Not Application.CommandBars("Worksheet Menu Bar").FindControl(ID:=18, recursive:=True).Enabled)
    End Function

    We have tested it now - runtime this *always* says FALSE!

    So - sorry to say it folks and experts - this approch is no good! I suppose that I can NOT in any way get this information?!?!?!?!


    Kind regards,
    Michael Mogensen

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: How to obtain cell-edit mode? (Excel2003 SP2)

    This has been discussed extensively in the thread starting at <post:=680,781>post 680,781</post:>. You can't run VBA code within Excel itself while the user is editing a cell, so your function will only work when the user is *not* editing a cell, and consequently return False.

  3. #3
    New Lounger
    Join Date
    Oct 2007
    Location
    Copenhagen, Denmark
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How to obtain cell-edit mode? (Excel2003 SP2)

    Hi Hans!

    Thanx' my friend - and sorry to bring this topic up again...

    Can we agree that the situation is this: "You bring me a method to check if you are in state A or in state B - though remember that the method ONLY ONLY ONLY works if you are in state B - otherwise it's 100% - check it out !"

    So bottom line: We can't have Excel to tell us that detail - right?

    Kind regards,
    Michael Mogensen.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: How to obtain cell-edit mode? (Excel2003 SP2)

    > We can't have Excel to tell us that detail - right?

    Right. You'd need code running outside of Excel (in a DLL for example) to be able to tell you if the user is editing a cell. But you still wouldn't be able to use that information in VBA code running in Excel.

  5. #5
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: How to obtain cell-edit mode? (Excel2003 SP2)

    As mentioned before, Excel VBA can NOT tell when you are in Edit mode, since when you are Edit mode, VBA does NOT run. It can ONLY run when you are not in Edit mode. It is a lovely Catch-22 reminiscent of the exchange between the man named Major Major Major after the army decides to promote him to rank of Major: <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

    Maj. Major Major Major: "Sergeant, from now on, I don't want anyone to come in and see me while I'm in my office. Is that clear?"
    First Sgt. Towser: "Yes, sir? What do I say to people who want to come in and see you while you're gone?"
    Maj. Major Major Major: "Tell them I'm in and ask them to wait."
    First Sgt. Towser: "For how long?"
    Maj. Major Major Major: "Until I've left."
    First Sgt. Towser: "And then what do I do with them?"
    Maj. Major Major Major: "I don't care."
    First Sgt. Towser: "May I send people in to see you after you've left?"
    Maj. Major Major Major: "Yes."
    First Sgt. Towser: "You won't be here then, will you?"
    Maj. Major Major Major: "No."

    Steve

  6. #6
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How to obtain cell-edit mode? (Excel2003 SP2)

    Oh yes you can!!!
    Attached Files Attached Files
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: How to obtain cell-edit mode? (Excel2003 SP2)

    It's a nice demonstration, but Excel crashes *very* often when I try it, so I wouldn't want to use this in a serious application...

  8. #8
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How to obtain cell-edit mode? (Excel2003 SP2)

    I know. I didn't include the warning message just for the heck of it <img src=/S/smile.gif border=0 alt=smile width=15 height=15>.

    OTOH, it shows it should work from a VB6 COM addin.
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  9. #9
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: How to obtain cell-edit mode? (Excel2003 SP2)

    Yes, that should be OK.

Posting Permissions

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