PDA

View Full Version : Solved: keep one document open, close all others



s?ren
04-05-2006, 04:16 AM
1) How can I make a macro that will allow me to keep one specific document open, while at the same time close all others. I don't know the names of the other documents? Something like "close all documents except mydocument"?

2) I use this macro to protect certain sections and it works fine, but is there another way to do this, because it seems to me to be a longhaired method?

S?ren

Killian
04-05-2006, 05:05 AM
Assuming you document is named "mydocument.doc", this will do itDim doc As Document

For Each doc In Application.Documents
If doc.Name <> "mydocument.doc" Then
doc.Close False 'closes without saving
End If
Next doc