+ Reply to Thread
Results 1 to 3 of 3

Unexpected Error when hiding the ribbon during workbook open event - Excel 2016

  1. #1
    Registered User
    Join Date
    08-01-2018
    Location
    Massachusetts, USA
    MS-Off Ver
    Microsoft Office Professional Plus 2016
    Posts
    1

    Unhappy Unexpected Error when hiding the ribbon during workbook open event - Excel 2016

    I am being thrown an unexpected error message from excel when I include the following line in my workbook open procedure:

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

    The following error is displayed in the active window after the workbook loads:

    ExcelError.jpg

    I want to fully hide the ribbon and not minimize it (like SendKey ^F11) so the user does not have the ability to access it (mainly to remove copy/pasting from the clipboard ribbon), hence my use of an Excel 4 Macro as opposed to ExecuteMso or the other few methods that may exist. I have even tried housing the line within a loop that checks the status of the ribbon to ensure it does not attempt to hide when hidden or show when shown (using Get.ToolBar(7, "Ribbon")). No matter what I do this code creates the error. The workbook still functions properly as if the error did not change anything but I would still like to get rid of it and/or find out why it is happening. The workbook and worksheets inside are usually protected but during the open procedure I begin by unlocking the structure and all of the sheets so that should not be the issue. I have this line, and a function that disables cut/copy/paste in the following events:workbook_open, workbook_close (opposite boolean values), workbook_activate, workbook_windowactivate, workbook_deactivate (opposite boolean values), and workbook_windowdeactivate (opposite boolean values)
    to ensure it only applies to the current workbook. Whenever the aforementioned line is commented out, the workbook opens without the error showing up. Does anyone know what is causing this/how to fix it? Or even just how to suppress the error message? - I have attempted Application.DisplayAlerts = False prior to the Excel4Macro with no success

    Below are the Copy Details from the error message minus the stack trace (Forum won't allow me to paste it in):

    Feedback Type:
    Frown (Error)

    Error Message:
    Exception from HRESULT: 0x800A03EC

  2. #2
    Registered User
    Join Date
    08-06-2014
    Location
    Bolton
    MS-Off Ver
    2010
    Posts
    1

    Re: Unexpected Error when hiding the ribbon during workbook open event - Excel 2016

    I am having the same issue; I have a button that toggles between full screen and ribbon, formula bar etc on show.
    When the workbooks loads for the first time I get the above error when I click the button for the first time? close the prompt and the button works fine from then on?
    very odd.
    it's definitely Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)" that cause the the error.
    I have been using this same piece of code for years without issue.
    has anyone got a work around, not "sendkeys" :0)
    has it been updated?
    Cheers in advance

  3. #3
    Registered User
    Join Date
    05-06-2008
    Posts
    5

    Re: Unexpected Error when hiding the ribbon during workbook open event - Excel 2016

    i have same issue here.. Can somebody help us resolve the Unexpected Error? Please...
    is there any command to substitute these code Application.ExecuteExcel4Macro "SHOW.TOOLBAR(""Ribbon"",False)" to hide the Excel ribbon without any error...

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Workbooks collection only returns one open workbook in Excel 2016
    By myfathersson in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-18-2017, 03:32 PM
  2. VBA Open FilePath from FTP location - Excel 2016 error
    By mwc360 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-14-2017, 01:34 PM
  3. 1004 Error from Workbook Open Event
    By nKife in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-09-2016, 06:55 PM
  4. [SOLVED] Error on password unprotect macro upon workbook open event
    By phpolicylady in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-13-2015, 02:00 PM
  5. Why won't Excel 2016 display my custom ribbon?
    By rkjudy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-05-2015, 04:20 PM
  6. Hiding the ribbon ONLY in my workbook, but not in other open workbooks?
    By jonvanwyk in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-26-2011, 07:32 AM
  7. Unexpected error 1004 when using workbooks.open
    By AHD in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-06-2005, 07:05 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1