isacp said:
i want it to close the three workbooks and not save it. i have it in the code to close but every time i run the macro it asks if i want to save it is there a way to write in the code not to save it.
I believe this should work:
<font face=Tahoma>Application.DisplayAlerts = <SPAN style="color:#00007F">False</SPAN>
ActiveWorkbook.Close
<SPAN style="color:#007F00">'Code to close workbooks goes here</SPAN>
Application.DisplayAlerts = <SPAN style="color:#00007F">True</SPAN></FONT>
also what is the code for a save as
and then have it read a ans from a msgbox and use it as the save as name
Try:
<font face=Tahoma><SPAN style="color:#00007F">Sub</SPAN> test2()
<SPAN style="color:#00007F">Dim</SPAN> SaveName <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Variant</SPAN>
SaveName = Application.InputBox("Name the file:", "Save File", Type:=2)
<SPAN style="color:#00007F">If</SPAN> SaveName = <SPAN style="color:#00007F">False</SPAN> <SPAN style="color:#00007F">Then</SPAN>
<SPAN style="color:#00007F">Exit</SPAN> <SPAN style="color:#00007F">Sub</SPAN> <SPAN style="color:#007F00">'if cancel is clicked</SPAN>
<SPAN style="color:#00007F">Else</SPAN>
ActiveWorkbook.SaveAs Filename:=SaveName
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN>
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>