Consulting

Results 1 to 2 of 2

Thread: Solved: Self Destruct file

  1. #1

    Solved: Self Destruct file

    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

  2. #2
    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






Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •