+ Reply to Thread
Results 1 to 9 of 9

Handling dialog does during running macros

  1. #1
    Registered User
    Join Date
    02-08-2005
    Location
    Kent, UK
    MS-Off Ver
    2010
    Posts
    69

    Handling dialog does during running macros

    I've created a lot of macros and in the process of tidying them up. I'd like to suppress most if not all dialogs that pop up while the macros run. I see there are various ways to automatically close the boxes but I'm after specific answers. How do I:

    - Select No for saving to clipboard when closing a file
    - Select Yes to overwriting a file when saving a file
    - Select Yes to deleting worksheet tabs
    - Select Yes to using an existing data table name when pasting data from one sheet to another
    - Select Read-Only to opening a file already open
    - Select Update to updating external sources when opening a file
    - Select Yes to saving changes when closing a file
    - Select No to saving changes when closing a file

    I know you can suppress the dialog boxes Application.DisplayAlerts command but that doesn't always select the preferred option.

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,978

    Re: Handling dialog does during running macros

    - Select No for saving to clipboard when closing a file : Application.CutCopyMode = False
    - Select Yes to overwriting a file when saving a file : DisplayAlerts
    - Select Yes to deleting worksheet tabs : DisplayAlerts
    - Select Yes to using an existing data table name when pasting data from one sheet to another : DisplayAlerts
    - Select Read-Only to opening a file already open : why open a file already open?
    - Select Update to updating external sources when opening a file : one of the Open arguments UpdateLinks:=True
    - Select Yes to saving changes when closing a file : wb.Close True
    - Select No to saving changes when closing a file : wb.Close False
    Everyone who confuses correlation and causation ends up dead.

  3. #3
    Registered User
    Join Date
    02-08-2005
    Location
    Kent, UK
    MS-Off Ver
    2010
    Posts
    69

    Re: Handling dialog does during running macros

    Thanks.

    Why open a file already open? Because it's a shared file that is normally open by another user. I need to select Read-Only as I only need to copy data from the sheet and nothing more.
    Last edited by koltregaskes; 06-22-2011 at 11:47 AM.

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,978

    Re: Handling dialog does during running macros

    Ah, I thought you meant already open on the same machine. You can also specify ReadOnly as one of the Open arguments.

  5. #5
    Registered User
    Join Date
    02-08-2005
    Location
    Kent, UK
    MS-Off Ver
    2010
    Posts
    69

    Re: Handling dialog does during running macros

    Great. I'll dig around the help on exactly how to implement these commands.

    BTW, when you suppress notifications does it select the default value, e.g. suppressing overwrite file will select the defaulted Yes option?

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,978

    Re: Handling dialog does during running macros

    Yes, it selects the default option, not always Yes.

  7. #7
    Registered User
    Join Date
    02-08-2005
    Location
    Kent, UK
    MS-Off Ver
    2010
    Posts
    69

    Re: Handling dialog does during running macros

    Understand. Thank you very much for your help.

    My macros are much cleaner. :-)

  8. #8
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,978

    Re: Handling dialog does during running macros

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

  9. #9
    Registered User
    Join Date
    02-08-2005
    Location
    Kent, UK
    MS-Off Ver
    2010
    Posts
    69

    Re: Handling dialog does during running macros

    Who is ever satisfied? ;-) Seriously though, OK will do but have another quick question?

    During running one of my macros it's asking to replace columns on a sheet, would one of the above suppress the message and replace the columns without asking?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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