View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default how to disable saving???

You can still put that code in the workbook you describe (the one you don't
want saved). If your code needs to save it with its original name, you can
just do

Application.enableEvents
workbooks("Data.xls").Save
Application.enableEvents

If you want to close it without saving and don't want the prompt

Workbooks("Data.xls").Close Savechanges:=False

Not sure why you think that BeforeSave is not a workable approach, even
given the scenario you describe.

But for diversity, you can also change the file's access mode to readonly

workbooks("data.xls").ChangeFileAccess Mode:=xlReadOnly

--
Regards,
Tom Ogilvy


"willroy" wrote in message
...
Hi Tom

Thats very handy to know, thanks.

However, I am running a macro which opens the desired user's workbook,
autofilters data by specific dates, renames the worksheet, so I need to
disable anyone from saving the adjusted file after the macro has
performed.

I know I could prigram the workbook to close afterwards, but want to be
able to leave it open for the user to view.

I hope you can help.

Thanks

Will


---
Message posted from http://www.ExcelForum.com/