Re: close all other workbooks
- From: "Nick Hodge" <nick_hodgeTAKETHISOUT@xxxxxxxxxxxxxxxxx>
- Date: Sun, 5 Feb 2006 13:40:33 -0000
Rob
Something like this will do it, suing the workbook_open() event
Private Sub Workbook_Open()
Dim wb As Workbook
Dim ThisWBName As String
ThisWBName = Me.Name
For Each wb In Workbooks
If wb.Name <> ThisWBName Then
wb.Close saveChanges:=True
End If
Next wb
End Sub
--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
"Rob" <Rob@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:9BDF4A49-EC1B-40AD-A2DF-FEBE32C19566@xxxxxxxxxxxxxxxx
I have a workbook that is very large and I would like a simple code that
closes any open workbooks when I open this one. I have quite a few macros
in
this workbook and I tried to use the workbooks.close statement but of
course
that closes all workbooks. I don't see see anything like Before_Open as a
macro. Can someone please help.
.
- Prev by Date: Re: generate multi row event from single entry
- Next by Date: Re: "Flipping" a matrix
- Previous by thread: Re: close all other workbooks
- Next by thread: How to know the linked cell of a check box
- Index(es):
Relevant Pages
|