Results 1 to 10 of 21

Thread: Close All Open Excel Files With VBA Open Close File issue unsolved

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #6
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    10,457
    Rep Power
    10
    Quote Originally Posted by fixer View Post
    ..... rest all files should be closed there can be 2 or 3 or file can be opened
    This is contradiction?????

    A file can be closed
    A file van be left opened
    A file cannot be open and closed – That is nonsense.


    Try to explain again please

    Or

    Try this
    Code:
    Sub STEP_CloseOnly_Book1_xlsm()
    Dim AnyWb As Workbook
        For Each AnyWb In Workbooks
            If AnyWb.Name = "Book1.xlsm" Then
             AnyWb.Close Savechanges = True
            Else
             
            End If
        Next AnyWb
    End Sub
    Or
    Code:
    Sub Close_Book1_xlsm()
     Workbooks("Book1.xlsm").Close Savechanges = True
    End Sub
    Last edited by DocAElstein; 03-03-2020 at 04:28 PM.
    ….If you are my competitor, I will try all I can to beat you. But if I do, I will not belittle you. I will Salute you, because without you, I am nothing.
    If you are my enemy, we will try to kick the fucking shit out of you…..
    Winston Churchill, 1939
    Save your Forum..._
    KILL A MODERATOR!!

Similar Threads

  1. Replies: 1
    Last Post: 02-19-2015, 03:49 AM
  2. Replies: 4
    Last Post: 04-10-2014, 10:58 PM
  3. Replies: 6
    Last Post: 09-07-2013, 03:40 PM
  4. Replies: 15
    Last Post: 08-23-2013, 12:03 PM
  5. Replies: 4
    Last Post: 06-09-2013, 01:43 AM

Tags for this Thread

Posting Permissions

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