Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Rob explained on 7/18/2011 :
On Jul 18, 10:33*am, GS wrote: Try... Test Menu.xlsm: Sub OpenTestWB() * Workbooks.Open("C:\Data\TestWb.xlsm") End Sub Sub CloseThisWB2() * ThisWorkbook.Close SaveChanges:=False End Sub TestWB.xlsm: Sub CloseThisWB1() * ThisWorkbook.Close SaveChanges:=False End Sub -- Garry Free usenet access athttp://www.eternal-september.org ClassicVB Users Regroup! comp.lang.basic.visual.misc Garry, Thank you this worked, but I'd like to understand why my original code works on some machines and not others. Thanks again for your help. Rob You're welcome, Rob! Note that... 'ThisWorkbook' is an EXPLICIT (fully qualified) reference to the file containing the currently running code. 'ActiveWorkbook' is an IMPLICIT reference to whatever workbook belongs to the currently active window. 'Application.Quit' shuts down Excel. I don't think this is what you want to do. 'Application.DisplayAlerts = False' ALWAYS NEEDS TO BE TURNED BACK ON!!! Thus, should only be used to temporarily cancel unwanted messages while certain things are being done via code which would otherwise generate an alert. Example... Sub DoStuff() With Application .ScreenUpdating = False vCalcMode = .Calculation .Calulation = xlCalulationManual End With 'Do stuff... Application.DisplayAlerts = False 'Do stuff that raises an alert you want to cancel... Application.DisplayAlerts = True 'Do more stuff... 'Cleanup With Application .ScreenUpdating = True .Calculation = vCalcMode End With End Sub -- Garry Free usenet access at http://www.eternal-september.org ClassicVB Users Regroup! comp.lang.basic.visual.misc |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
ActiveWorkbook.close problem | Excel Programming | |||
ActiveWorkbook.close problem | Excel Programming | |||
In Before Close Sub ActiveWorkBook.Close(False) repeat procedure | Excel Programming | |||
Problem with Activeworkbook.Close SaveChanges:=False | Excel Programming | |||
ActiveWorkbook.Close | Excel Programming |