+ Reply to Thread
Results 1 to 7 of 7

DisplayAlerts = False chooses the default response

  1. #1
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,879

    DisplayAlerts = False chooses the default response

    Hi,

    While using VBA, when there is a need to suppress alerts, I use Application.DisplayAlerts = False.

    DisplayAlerts = False chooses the default response. What if I had to chose a different response. Is there a way to do it?

    In the attached screenshot, the default is Update, however I wish to select Don't Update everytime this pops up.

    Is there a way to do it?

    P.S. - I know about Application.AskToUpdateLinks = False

    I am just interested in knowing how to select a non default option.
    Attached Images Attached Images
    Last edited by NeedForExcel; 10-14-2016 at 12:33 AM.
    Cheers!
    Deep Dave

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: DisplayAlerts = False chooses the default response

    Hi,

    You must either use the appropriate argument in the code that triggers the dialog- such as specifying not to update links when you open a workbook- or you must use CBT hooks and API function calls to find and send messages to the appropriate control. The former is obviously preferable when possible as there is unlikely to be a generic routine for the latter.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,879

    Re: DisplayAlerts = False chooses the default response

    Hi xlnitwit,

    Thank You for the reply..

    The solutions shared by you are very new to me.

    It would be generous of you if you could share some links or something that can send me in the right direction.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,549

    Re: DisplayAlerts = False chooses the default response

    Look at: https://msdn.microsoft.com/en-us/lib...or=-2147217396

    Use: UpdateLinks parameter to determine what option you want to take
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  5. #5
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: DisplayAlerts = False chooses the default response

    Here is a simple example of setting a hook- http://www.excely.com/excel-vba/chan...-buttons.shtml

    In order to actually click a button, you would require the GetDlgItem API to get its window handle and then use SendMessage to send it a click event. That is not as straightforward as it may sound because you need to know in advance the correct ID to pass to GetDlgItem to get a handle to the correct button.

    All in all, it is much easier to avoid the issue if at all possible.

  6. #6
    Forum Expert NeedForExcel's Avatar
    Join Date
    03-16-2013
    Location
    Pune, India
    MS-Off Ver
    Excel 2016:2019, MS 365
    Posts
    3,879

    Re: DisplayAlerts = False chooses the default response

    Hi,

    Thank you for the replies..

    Sorry for my delayed response, I have not been able to access Excel Forum Lately.

    Reps added

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,549

    Re: DisplayAlerts = False chooses the default response

    You're welcome. Thanks for the rep.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] All in one line of code: ScreenUpdating=False, Calculation=Manua, DisplayAlerts=False
    By luv2glyd in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-13-2016, 03:10 PM
  2. [SOLVED] Application.DisplayAlerts = False does not work
    By tryer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-23-2013, 10:23 AM
  3. Worksheet Equivalent to DisplayAlerts=False
    By SDruley in forum Excel General
    Replies: 0
    Last Post: 08-18-2010, 09:32 AM
  4. Application.DisplayAlerts = False
    By Jim May in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-18-2006, 12:35 PM
  5. [SOLVED] Where to put DisplayAlerts = False
    By Joe Fish in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-22-2005, 05:05 PM
  6. [SOLVED] DisplayAlerts = false not working
    By Mark Stephens in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-13-2005, 02:05 AM
  7. [SOLVED] DisplayAlerts and ScreenUpdate will not set to False
    By Joe at Baso in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 04-05-2005, 03:06 PM

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