Close workbook/clipboard thru macro
Close workbook/clipboard thru macro
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 4 of 4

Thread: Close workbook/clipboard thru macro

  1. #1
    New Member
    Join Date
    Mar 2002
    Posts
    16
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    I'm writing macros to generate reports from a database. I'm closing a workbook via macro after I've copied a quantity of data into another. I've been able to close the workbook automatically, but I still get the message about data on the clipboard & have to manually click save or delete. Anyway to automate that as well?

  2. #2
    MrExcel MVP Mark O'Brien's Avatar
    Join Date
    Feb 2002
    Location
    Columbus, OH, USA
    Posts
    3,530
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I think this works, use DisplayAlerts like this.



    Application.DisplayAlerts = False

    'Your code for closing etc


    HTH

  3. #3
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Bogota, Colombia
    Posts
    11,959
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Mark, I seem to remember that this isn't affected by DisplayAlerts. You can, however do this before closing:

    Application.CutCopyMode = False

    or

    Range("A1").Copy

    Basically, reduce the Clipboard size so Excel won't pop up the message.
    Regards,

    Juan Pablo González
    http://www.juanpg.com

  4. #4
    New Member
    Join Date
    Mar 2002
    Posts
    16
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    Thanks Juan - the Application... line worked just fine!

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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

 

 
DMCA.com