ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Macro help (https://www.excelbanter.com/excel-worksheet-functions/128675-macro-help.html)

Manju

Macro help
 
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


Gary''s Student

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



CLR

Macro help
 
Application.DisplayAlerts = False 'shuts off the pop-ups
Put your SAVE code here...............
Application.DisplayAlerts = True 'turns things back to normal
Application.Quit

hth
Vaya con Dios,
Chuck, CABGx3



"Manju" wrote in message
oups.com...
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




Gord Dibben

Macro help
 
Manju

With Activeworkbook 'assuming this is the temporary file
.Saved = True 'does not save changes
.Close
End with


Gord Dibben MS Excel MVP

On 31 Jan 2007 15:57:26 -0800, "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



Manju

Macro help
 
Thanks!
This worked.

On Feb 1, 6:10 am, Gord Dibben <gorddibbATshawDOTca wrote:
Manju

With Activeworkbook 'assuming this is the temporary file
.Saved = True 'does not save changes
.Close
End with

Gord Dibben MS Excel MVP

On 31 Jan 2007 15:57:26 -0800, "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- Hide quoted text -


- Show quoted text -





All times are GMT +1. The time now is 02:33 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com