+ Reply to Thread
Results 1 to 3 of 3

Macro, or excel program to "Close All' while in a workspace

  1. #1
    Carlton Patterson
    Guest

    Macro, or excel program to "Close All' while in a workspace

    Hello all,

    I usually run a couple of workbooks in one workspace and the only way to
    close the workbooks within a workspace is to either:

    1) Close each workbook individually

    2) Holding the 'shift' key and clicking on 'file' and then clicking on
    'close all'.

    I have been trying to record a macro to make this easier, but without
    any success.

    Can someone either let me know if there is another way to close a number
    of workbooks within a workspace or help me put together a macro or an
    excel program that will alleviate this laborious action?

    Cheers

    Carlton

    *** Sent via Developersdex http://www.developersdex.com ***

  2. #2
    Gary Brown
    Guest

    RE: Macro, or excel program to "Close All' while in a workspace

    Put this macro in your Personal.xls workbook as a module...
    '/=====================================/
    Sub CloseEmAll()
    Dim wb As Workbook

    For Each wb In Workbooks
    If UCase(wb.Name) <> "PERSONAL.XLS" Then
    ' Application.DisplayAlerts = False
    wb.Close
    ' Application.DisplayAlerts = True
    End If
    Next wb

    End Sub
    '/=====================================/
    This will close all open workbooks, hidden or visible with the exception of
    the Personal.xls. It will not save the opened workbooks.
    To have Excel ask you if you want to save any changed workbooks, uncomment
    the 'DisplayAlerts' lines.
    HTH,
    --
    Gary Brown
    [email protected]


    "Carlton Patterson" wrote:

    > Hello all,
    >
    > I usually run a couple of workbooks in one workspace and the only way to
    > close the workbooks within a workspace is to either:
    >
    > 1) Close each workbook individually
    >
    > 2) Holding the 'shift' key and clicking on 'file' and then clicking on
    > 'close all'.
    >
    > I have been trying to record a macro to make this easier, but without
    > any success.
    >
    > Can someone either let me know if there is another way to close a number
    > of workbooks within a workspace or help me put together a macro or an
    > excel program that will alleviate this laborious action?
    >
    > Cheers
    >
    > Carlton
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    >


  3. #3
    Carlton Patterson
    Guest

    RE: Macro, or excel program to "Close All' while in a workspace

    Hi Gary,

    Thanks for responding to my request. That is exactly what I needed.

    Cheers mate.

    Carlton

    *** Sent via Developersdex http://www.developersdex.com ***

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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