none
Application.OnKey is not working when cell is in edit mode. RRS feed

  • Question

  • Hello all,

    I have one problem with Application OnKey's.

    I have disabled the Excel Save functinality and enabling custom method on Ctrl + S key. It is working fine when cursor is out side of the cell but failing when cell is in edit mode, and Excels default Save functionality firing.

    Please let me know if you need any other info.

    Thanks in Advance.

    Sreenivas


    sreenivas
    Friday, December 23, 2011 6:06 AM

Answers

  • I wouldn't want to!
     
    This means that the user (you??) made a change and tried to save the file.
    Because the file is marked readonly, the save (using the same file location and
    file name) will fail.
     
    And there may be instances where the user really needs to save as a new name.  I
    think that this is more of a training issue than a technical issue.  But that's
    just a guess.  I don't understand exactly what and why you want to do.
     
     
    spvarapu wrote:
    >
    > Hi Dave,
    >
    > I am getting Read-Only dialog box after making the workbook as Read-only.
    >
    > How can i stop these alerts ?
    >
    > Thanks
    >
    >
    >
    > ------------------------------------------------------------------------------
    > sreenivas
     
    --
     
    Dave Peterson
     
    • Marked as answer by spvarapu Monday, January 2, 2012 9:48 AM
    Wednesday, December 28, 2011 12:19 PM

All replies

  • hi Sreenivas,
     
    have you tried with the event "Workbook_BeforeSave"
     Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
    Cancel = True
    End Sub
     --
    isabelle
     
    Le 2011-12-23 01:06, spvarapu a écrit :
    > Hello all,
    >
    > I have one problem with Application OnKey's.
    >
    > I have disabled the Excel Save functinality and enabling custom method on Ctrl + S key. It is working fine when cursor is out side of the cell but failing when cell is in edit mode, and Excels default Save functionality firing.
    >
    > Please let me know if you need any other info.
    >
    > Thanks in Advance.
    >
    > Sreenivas
    >
    > --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    > sreenivas
     
    Friday, December 23, 2011 6:26 AM
  • Hi isabelle,

    I am already having Cancel=True in BeforeSave event as i need to prevent workbook Save method. But still the problem is there.

    Thanks for quick response.

    Sreenivas


    sreenivas
    Friday, December 23, 2011 10:36 AM
  • I don't think that there's any meaningful macro that can run when you're in edit
    mode.
     
    If you want to prevent all saving, you could mark the file readonly (using
    windows explorer) or put the file on a readonly network share.
     
    spvarapu wrote:
    >
    > Hello all,
    >
    > I have one problem with Application OnKey's.
    >
    > I have disabled the Excel Save functinality and enabling custom method on Ctrl
    > + S key. It is working fine when cursor is out side of the cell but failing
    > when cell is in edit mode, and Excels default Save functionality firing.
    >
    > Please let me know if you need any other info.
    >
    > Thanks in Advance.
    >
    > Sreenivas
    >
    > ------------------------------------------------------------------------------
    > sreenivas
     
    --
     
    Dave Peterson
     
    • Proposed as answer by JP2112 Tuesday, December 27, 2011 8:50 PM
    Friday, December 23, 2011 12:26 PM
  • Thanks  Dave Peterson..

    I need to check this option and will update..


    sreenivas
    Saturday, December 24, 2011 2:31 PM
  • Hi Dave,

    I am getting Read-Only dialog box after making the workbook as Read-only.

    How can i stop these alerts ?

    Thanks


    sreenivas
    Wednesday, December 28, 2011 4:39 AM
  • I wouldn't want to!
     
    This means that the user (you??) made a change and tried to save the file.
    Because the file is marked readonly, the save (using the same file location and
    file name) will fail.
     
    And there may be instances where the user really needs to save as a new name.  I
    think that this is more of a training issue than a technical issue.  But that's
    just a guess.  I don't understand exactly what and why you want to do.
     
     
    spvarapu wrote:
    >
    > Hi Dave,
    >
    > I am getting Read-Only dialog box after making the workbook as Read-only.
    >
    > How can i stop these alerts ?
    >
    > Thanks
    >
    >
    >
    > ------------------------------------------------------------------------------
    > sreenivas
     
    --
     
    Dave Peterson
     
    • Marked as answer by spvarapu Monday, January 2, 2012 9:48 AM
    Wednesday, December 28, 2011 12:19 PM
  • Thanks Dave for you time and wish you happy new year 2012.

    You are correct, this is kind of training issue.

    Currently i have disabled the Workbook Save option from ribbon.xml. 

    Giving alert message in Workbook_BeforeSave event, this will be shown when user tries to save when cell is in Edit mode.

     

    <officeMenu>
    <button idMso="FileSave" visible="false"/>
    </officeMenu> 

    Thanks again

    Sreenivas


    sreenivas
    Monday, January 2, 2012 9:47 AM