View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Jim Feaver Jim Feaver is offline
external usenet poster
 
Posts: 16
Default Closing files without save

A couple other things.

If wb.Saved = false then wb.Save



i = 0

For Each wb In Workbooks

If Not (wb.Name = "Personal.xls") Then

i = i + 1

End If

Next wb



Application.EnableEvents = False

Application.DisplayAlerts = False



If i = 1 Then

Application.Quit

Else

ThisWorkbook.Close (False)

End if

Application.EnableEvents = True

Application.DisplayAlerts = True

Set wb = Nothing

Set ws = Nothing



hth,

Jim Feaver


"Pete McCosh" wrote in message
...
Application.cutcopymode=false
Activeworkbook.close savechanges:=false


-----Original Message-----
I am writing a macro which opens and closes a series of

other workbooks.
When I close a workbook, Excel prompts me if I want to

save the file and if
I want to delete whatever is left on the clipboard.

How can I, in VBA, close a workbook without saving it and

not have Excel
displaying a dialog box asking if I want to save?
Also, how can I surpress the question about the

clipboard, and automatically
have Excel to discard those items left on the clipboard?

Thanks in advance,
Warren