+ Reply to Thread
Results 1 to 6 of 6

How do I detect and commit the current cell edition?

  1. #1

    How do I detect and commit the current cell edition?

    Hi,

    How can I detect that the user is currently editing a cell, and to commit
    the edit?

    I am trying to call SaveCopyAs from a COM add-in and I get a COM exception
    if a cell is being edited. I would like to finish the edit to correctly save
    the workbook without an exception.

    Thanks,
    Bret

  2. #2
    Jim Thomlinson
    Guest

    RE: How do I detect and commit the current cell edition?

    The editing of a cell does not generate any events. There is a change event
    but it only fires when the editing is complete...
    --
    HTH...

    Jim Thomlinson


    "[email protected]" wrote:

    > Hi,
    >
    > How can I detect that the user is currently editing a cell, and to commit
    > the edit?
    >
    > I am trying to call SaveCopyAs from a COM add-in and I get a COM exception
    > if a cell is being edited. I would like to finish the edit to correctly save
    > the workbook without an exception.
    >
    > Thanks,
    > Bret


  3. #3
    Peter Huang [MSFT]
    Guest

    RE: How do I detect and commit the current cell edition?

    Hi Bret,

    Based on my research through the whole Word Object Modal, there is no such
    a property or event to know if now we are in edit mode.
    But I think you may try to try catch and then use the code below to end the
    edit mode.
    In Edit Mode, the Excel messge will enter a loop(similar as a modal
    dialog,msgbox), so most of menu and button will be grey out.
    Based on my test, it will work in the Save Button.
    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
    Boolean)
    MsgBox Application.ActiveCell.AddressLocal
    Debug.Print "Save"
    Cells(1, 1).Select
    End Sub


    Best regards,

    Peter Huang

    Microsoft Online Community Support
    ==================================================
    When responding to posts, please "Reply to Group" via your newsreader so
    that others may learn and benefit from your issue.
    ==================================================
    This posting is provided "AS IS" with no warranties, and confers no rights.


  4. #4
    Peter Huang [MSFT]
    Guest

    RE: How do I detect and commit the current cell edition?

    Hi Bret,

    Have you tried my suggestion?
    Did that work for you?
    If you still have any concern, please feel free to post here.


    Best regards,

    Peter Huang

    Microsoft Online Community Support
    ==================================================
    When responding to posts, please "Reply to Group" via your newsreader so
    that others may learn and benefit from your issue.
    ==================================================
    This posting is provided "AS IS" with no warranties, and confers no rights.


  5. #5

    RE: How do I detect and commit the current cell edition?

    Hi Peter,

    Thanks for your help.

    I didn't follow exactly how your suggestion can help me, and I haven't had a
    chance yet to play further on your ideas.

    I can see that Cells(1,1).Select() will probably end any editing action to
    move the selection. However this is not acceptable for me, because if the
    user has a normal selection, I don't want to disrupt it. I didn't follow how
    you were first detecting the edit mode? Are you suggesting that I can test if
    a certain menu button is disabled?

    Thanks,
    Bret

  6. #6
    Peter Huang [MSFT]
    Guest

    RE: How do I detect and commit the current cell edition?

    Hi Bret,

    I am sorry if I did not make it clear.
    As Jim suggested, there is no such an event which will generate when we
    are editing a cell.

    Per your descritpion, you wanted to detect the edit status because if you
    are trying to SaveCopyAs, you will get exception if the cell is in editing.

    So my suggest is that, when we try to save a file, Workbook_BeforeSave
    event will fire. Which gave us a chance to make sure the cell is not in the
    edit mode, so that we the Save work will not generate exception.

    If I misunderstood, please feel free to post there.



    Best regards,

    Peter Huang

    Microsoft Online Community Support
    ==================================================
    When responding to posts, please "Reply to Group" via your newsreader so
    that others may learn and benefit from your issue.
    ==================================================
    This posting is provided "AS IS" with no warranties, and confers no rights.


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1