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