Press enter when alert pops up in excel

  • Re: Press enter when alert pops up in excel


    Quote from AliGW;794025

    MODERATOR NOTICE: This topic has also been posted on other sites and may already have an answer elsewhere. Please take this into consideration when answering this question

    *



    Very funny:)


    But i need a macro because I am not near computer when it pops up..it is hapenning in the night...so any suggestion?

  • Re: Press enter when alert pops up in excel


    Not a joke - perhaps you had better read the rules to which you agreed upon joining this and other forums?


    Thank you for the links.

    Ali :)


    Enthusiastic self-taught user of MS Excel who's always learning!
    If anyone has helped you towards solving a problem, then you can thank them by clicking on the like icon bottom right.

    :!:Forum Rules

  • Re: Press enter when alert pops up in excel


    Ali, Igor88's opening post was a copy of his post on Stackoverflow and it does include a link to that thread.

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Re: Press enter when alert pops up in excel


    Quote from KjBox;794106

    Ali, Igor88's opening post was a copy of his post on Stackoverflow and it does include a link to that thread.


    It didn't when I first posted - it does now, and you will notice that I have thanked him for the links and deleted my post. :)

    Ali :)


    Enthusiastic self-taught user of MS Excel who's always learning!
    If anyone has helped you towards solving a problem, then you can thank them by clicking on the like icon bottom right.

    :!:Forum Rules

  • Re: Press enter when alert pops up in excel


    Sorry, missed that! :)


    Igor88


    The reason Application.DisplayAlerts does not work is because there is no default button on that message box. The only way round the problem is to cross over to the dark side and use SendKeys.


    Search for SendKeys in the VB Editor help box and get an idea how to use SendKeys.

    We now have a reputation system in place. If my reply helped please "Like" the reply by clicking the "Like" icon at bottom right of my reply.

  • Re: Press enter when alert pops up in excel





    I tried this and this didn't work


    Please HELP :(

  • Re: Press enter when alert pops up in excel


    Hello,


    Have you tried

    Code
    Application.SendKeys "{ENTER}"


    Hope this helps

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • Re: Press enter when alert pops up in excel


    Quote from Carim;794145

    Hello,


    Have you tried

    Code
    Application.SendKeys "{ENTER}"


    Hope this helps



    Thanks. but excel not recognize that i want to send "enter" to this popup


    my code is :


    Private Sub Workbook_Open()
    On Error Resume Next
    Application.DisplayAlerts = False
    ActiveWorkbook.LockServerFile
    SendKeys "{ENTER}", False

    End Sub


    When it goes to ActiveWorkbook.LockServerFile - the pop up comes out (before SendKeys "{ENTER}", False )....

  • Re: Press enter when alert pops up in excel


    Hello,


    Have you tested following :


    Code
    Private Sub Workbook_Open()
    On Error Resume Next
    SendKeys "{ENTER}", False
    ActiveWorkbook.LockServerFile
    End Sub


    Hope this will help

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • Re: Press enter when alert pops up in excel


    Yes. Tested it and still now working because the row that activates this pop up is :


    ActiveWorkbook.LockServerFile


    not before :(



    any idea?

  • Re: Press enter when alert pops up in excel


    A final attempt ...have you tried


    Code
    Application.SendKeys("~")


    Hope this helps

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • Re: Press enter when alert pops up in excel


    Quote from Carim;794157

    A final attempt ...have you tried


    Code
    Application.SendKeys("~")


    Hope this helps



    This is the same code , ~ to enter.


    The problem is in the row before : ActiveWorkbook.Lockserverfile - is stops the code and get a pop up out so the code not geeting to your row

  • Re: Press enter when alert pops up in excel


    Quote from Igor88;794165

    This is the same code , ~ to enter.


    The problem is in the row before : ActiveWorkbook.Lockserverfile - is stops the code and get a pop up out so the code not geeting to your row


    As indicated in a previous post, the SendKeys instruction line needs to be located just before the line ActiveWorkbook.LockserverFile ...

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

  • Re: Press enter when alert pops up in excel


    Quote from Carim;794167

    As indicated in a previous post, the SendKeys instruction line needs to be located just before the line ActiveWorkbook.LockserverFile ...



    Thank you! it worked :)



    Very strange , if i run the code row after row (F8) it is now working but if I run end to end without debugging it works

  • Re: Press enter when alert pops up in excel


    Glad you could fix your problem ..:wink:


    Thanks ...for your thanks ...:smile:

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!