Consulting

Results 1 to 3 of 3

Thread: Solved: Hide the Ribbon doesn't work on Startup form

  1. #1
    VBAX Regular
    Joined
    Jul 2008
    Posts
    14
    Location

    Solved: Hide the Ribbon doesn't work on Startup form

    I'm attempting to hide the Ribbon in Access 2010 (Windows 7) when opening my app with the following code. I need to support legacy users with Access 2003 as well as Access 2010.

    [vba]
    '**************************************************************
    Private Sub Form_Load()
    '**************************************************************
    If SysCmd(acSysCmdAccessVer) > 11 Then 'Access 2003 = 11.0
    docmd.showtoolbar "Ribbon", acToolbarNo
    End If
    End Sub
    [/vba]

    The code is associated with the Switchboard form that opens at Startup. This works properly when I manually open the form, but not when it opens automatically it by launching the app.

    I've tried adding this code to the Open, Load, Resize, and Current events for the form, all with the same results.

    Any ideas?
    Last edited by dhutch75; 10-16-2012 at 10:43 AM.

  2. #2
    VBAX Contributor
    Joined
    Oct 2011
    Location
    Concord, California
    Posts
    101
    Location
    What happens if you leave the If statement out and you're running your app in 2010? Is the ribbon still visible?

  3. #3
    VBAX Regular
    Joined
    Jul 2008
    Posts
    14
    Location
    I actually solved this problem myself but forgot to close the thread. The solution was EXTREMELY obscure.

    Background info:
    • I open this file programmatically from an external spreadsheet via VBA. The external file then prepopulates this file with data in 25-30 cells.
    • The action of writing this data from VBA causes the spreadsheet to flicker as it writes each cell entry. The screen updates also cause the write process to take considerably longer to run. To prevent these two undesirable effects, immediately after programmatically opening the workbook, I set Application.Visible = False. When all of the writes have finished, I set Application.Visible =True .
    • The workbook that I'm opening contains a query that automatically attempts to run when the file opens.
    • XL security settings prompt the user for permission to Enable/Disable the startup query.
    What I discovered:
    • The Enable/Disable prompt appears as soon as the first write to a cell occurs. (The security prompt does NOT happen when the spreadsheet first opens.)
    • If the workbook was NOT visible when security forced the visiblilty property to TRUE, the menus and toolbars remain hidden. Apparently, this security prompt restores visibility to the hidden workbook, but not to the hidden toolbars.
    The only way that I could keep toolbars visible was to set Application.Visible = True prior to the first write action.

    ... an interesting 'Feature' that took me a couple of days to identify!

    Deborah

Posting Permissions

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