PDA

View Full Version : VBA - answer "yes" or "no"



gimli
04-05-2010, 11:32 AM
Hi all,

can someone help out with the following code


' code blah blah blah here
TgtBk.Sheets("Imported Data").Range("C3").Resize(225, 27) = Ray 'Change(225, 27), to suit columns and rows
Workbooks("test.xls").Close
End Sub


When the work book test.xls closes, I get a question box asking if I want to save changes. Is there some code to answer this question with no user interaction? also doing this in the backround so nobody sees it would also be great.

thanks much

lucas
04-05-2010, 11:36 AM
Try this. Of course you would set it to false if you don't want to save the changes:

Workbooks("test.xls").Close True

gimli
04-05-2010, 12:02 PM
Lucas,

Worked perfectly.

Is there any code to add so the test.xls doesnt flash across the screen when opening and closing?

lucas
04-05-2010, 12:07 PM
Application.ScreenUpdating = False

before the action. Be sure to write the line again at the end and set it back to true.