PDA

View Full Version : Close workbook without warning popup if the flie is read only



leopaulc
12-12-2011, 12:31 PM
I have a macro that automatically closes out of all open workbooks linked to pickup the data.
however, I want it to close without saving the read only documents. Right now it closes out of everything, but a pop up appears asking if the user wants to save the read only worksheet.

I don't want that pop-up to appear. I want it to just exit out and save all spreadsheets except the read only ones WITHOUT asking.

The macro also asking for link updation message. can this also avoid while running the Macro?

Here is the current code is pasted below.


Sub Update()
'
' Update Macro
'
' Keyboard Shortcut: Ctrl+u
'
Range("D8").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
ActiveWindow.Close
Range("D9").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
ActiveWindow.Close
Range("D10").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
ActiveWindow.Close
Range("D11").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
ActiveWindow.Close
Range("D12").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
ActiveWindow.Close
End Sub

Admin
12-12-2011, 01:43 PM
Hi Leo,

Replace
ActiveWindow.Close

with


ActiveWindow.Close 0

leopaulc
12-12-2011, 01:51 PM
Thankyou verymuch... Great

Exactly what I need