PDA

View Full Version : Solved: Self Destruct file



av8tordude
07-08-2010, 05:41 AM
I discovered a conflict problem with the self destruct code and the code to hide the ribbon. Whenever the self destruct code would excute, it would generate and error below highlighting .Close False. I discovered that if the hide ribbon code is not used, then the self destruct code runs perfectly, but if I use the code to hide the ribbon, then it would generate the error. Can someone explain why there is a conflict and if there is solution?

Run-time error '1004':
Method 'Close' of object'_Workbook' failed



Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)"


Sub KillMe()
With ThisWorkbook
Call TitleBarOpen
.Saved = True
.ChangeFileAccess Mode:=xlReadOnly
Kill .FullName
.Close False
End With
End Sub

av8tordude
07-09-2010, 03:46 AM
If anyone intereted, i found an alternative solution to


Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)".


Display the full screen and disable the Esc key.


Sub HideRibbon
Application.DisplayFullScreen = True
Application.OnKey "{ESC}", "NoChange"
Application.DisplayFormulaBar = False
End Sub


To return back to normal state...




Sub UnHideRibbon
Application.DisplayFormulaBar = True
Application.DisableFullScreen = False
Application.OnKey "{ESC}

End Sub







Courtesy of Rick E.


Av8torudude