Thread: Macro help
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Macro help

Just make Excel THINK the file has been already saved:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.ThisWorkbook.Saved = True
End Sub

This goes in ThisWorkbook code
--
Gary''s Student
gsnu200703


"Manju" wrote:

Dear All
I have a macro which opens a temporary excel file modifies some data
copies and pastes into another file from where i call this macro and
closes the temporary file. At this point it stops and pops up a window
do you want to save this file since i have modified this file this
being a temporary file which I overwrite every time i dont need to
save but unless i press Yes or No the macro won't move further. How do
we avoid this? I know the answer may be simple But i create macros by
recording tool and not by directly writing in VB editor.

My main intention is to close the file without saving but shouldnot
wait for user input to do so.

Please Help
Manju